diff --git a/LibreMetaverse.sln b/LibreMetaverse.sln index e33b91c7..a7aa1090 100644 --- a/LibreMetaverse.sln +++ b/LibreMetaverse.sln @@ -1,58 +1,40 @@ -Microsoft Visual Studio Solution File, Format Version 14.00 -# Visual Studio 2015 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvatarPreview", ".\Programs\AvatarPreview\AvatarPreview.csproj", "{93CEA633-0000-0000-0000-000000000000}" +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26403.7 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Baker", "Programs\Baker\Baker.csproj", "{95F42663-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Baker", ".\Programs\Baker\Baker.csproj", "{95F42663-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSJ2K", "CSJ2K\CSJ2K.csproj", "{C276743B-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSJ2K", ".\CSJ2K\CSJ2K.csproj", "{C276743B-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridProxy", "Programs\GridProxy\GridProxy.csproj", "{79B51DAA-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dashboard", ".\Programs\examples\Dashboard\Dashboard.csproj", "{592827AA-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridProxyApp", "Programs\GridProxy\GridProxyApp.csproj", "{CF6ECF45-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridAccountant", ".\Programs\examples\GridAccountant\GridAccountant.csproj", "{6DE58F9A-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IRCGateway", "Programs\examples\IRCGateway\IRCGateway.csproj", "{89049BBC-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridImageUpload", ".\Programs\GridImageUpload\GridImageUpload.csproj", "{06BD6C42-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse", "LibreMetaverse\LibreMetaverse.csproj", "{27C70F3A-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridProxy", ".\Programs\GridProxy\GridProxy.csproj", "{79B51DAA-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse.GUI", "LibreMetaverse.GUI\LibreMetaverse.GUI.csproj", "{09C292AF-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GridProxyApp", ".\Programs\GridProxy\GridProxyApp.csproj", "{CF6ECF45-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse.Rendering.Meshmerizer", "LibreMetaverse.Rendering.Meshmerizer\LibreMetaverse.Rendering.Meshmerizer.csproj", "{95479B1D-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "groupmanager", ".\Programs\examples\groupmanager\groupmanager.csproj", "{97A800BC-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse.Rendering.Simple", "LibreMetaverse.Rendering.Simple\LibreMetaverse.Rendering.Simple.csproj", "{29E206AC-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Heightmap", ".\Programs\examples\Heightmap\Heightmap.csproj", "{16044D2B-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse.StructuredData", "LibreMetaverse.StructuredData\LibreMetaverse.StructuredData.csproj", "{89D7A3E5-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "importprimscript", ".\Programs\importprimscript\importprimscript.csproj", "{95C06600-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse.Tests", "LibreMetaverse.Tests\LibreMetaverse.Tests.csproj", "{0CCC2C3D-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IRCGateway", ".\Programs\examples\IRCGateway\IRCGateway.csproj", "{89049BBC-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse.Utilities", "LibreMetaverse.Utilities\LibreMetaverse.Utilities.csproj", "{1266CE08-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse", ".\LibreMetaverse\LibreMetaverse.csproj", "{27C70F3A-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverseTypes", "LibreMetaverseTypes\LibreMetaverseTypes.csproj", "{B37B02AD-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse.GUI", ".\LibreMetaverse.GUI\LibreMetaverse.GUI.csproj", "{09C292AF-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PacketDump", "Programs\examples\PacketDump\PacketDump.csproj", "{58443010-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse.Rendering.Meshmerizer", ".\LibreMetaverse.Rendering.Meshmerizer\LibreMetaverse.Rendering.Meshmerizer.csproj", "{95479B1D-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClient", "Programs\examples\TestClient\TestClient.csproj", "{9F71FDB3-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse.Rendering.Simple", ".\LibreMetaverse.Rendering.Simple\LibreMetaverse.Rendering.Simple.csproj", "{29E206AC-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VoiceTest", "Programs\VoiceTest\VoiceTest.csproj", "{EE4EA934-0000-0000-0000-000000000000}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse.StructuredData", ".\LibreMetaverse.StructuredData\LibreMetaverse.StructuredData.csproj", "{89D7A3E5-0000-0000-0000-000000000000}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse.Tests", ".\LibreMetaverse.Tests\LibreMetaverse.Tests.csproj", "{0CCC2C3D-0000-0000-0000-000000000000}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverse.Utilities", ".\LibreMetaverse.Utilities\LibreMetaverse.Utilities.csproj", "{1266CE08-0000-0000-0000-000000000000}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibreMetaverseTypes", ".\LibreMetaverseTypes\LibreMetaverseTypes.csproj", "{B37B02AD-0000-0000-0000-000000000000}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mapgenerator", ".\Programs\mapgenerator\mapgenerator.csproj", "{2867B4B3-0000-0000-0000-000000000000}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PacketDump", ".\Programs\examples\PacketDump\PacketDump.csproj", "{58443010-0000-0000-0000-000000000000}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrimWorkshop", ".\Programs\PrimWorkshop\PrimWorkshop.csproj", "{AC949F03-0000-0000-0000-000000000000}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClient", ".\Programs\examples\TestClient\TestClient.csproj", "{9F71FDB3-0000-0000-0000-000000000000}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VisualParamGenerator", ".\Programs\VisualParamGenerator\VisualParamGenerator.csproj", "{CF93CDA8-0000-0000-0000-000000000000}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VoiceTest", ".\Programs\VoiceTest\VoiceTest.csproj", "{EE4EA934-0000-0000-0000-000000000000}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinGridProxy", ".\Programs\WinGridProxy\WinGridProxy.csproj", "{455B06F4-0000-0000-0000-000000000000}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinGridProxy", "Programs\WinGridProxy\WinGridProxy.csproj", "{455B06F4-0000-0000-0000-000000000000}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -60,10 +42,6 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {93CEA633-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {93CEA633-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {93CEA633-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {93CEA633-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU {95F42663-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {95F42663-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {95F42663-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -72,18 +50,6 @@ Global {C276743B-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {C276743B-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU {C276743B-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {592827AA-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {592827AA-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {592827AA-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {592827AA-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {6DE58F9A-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6DE58F9A-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6DE58F9A-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6DE58F9A-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {06BD6C42-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {06BD6C42-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {06BD6C42-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {06BD6C42-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU {79B51DAA-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {79B51DAA-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {79B51DAA-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -92,18 +58,6 @@ Global {CF6ECF45-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {CF6ECF45-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU {CF6ECF45-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {97A800BC-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {97A800BC-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {97A800BC-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {97A800BC-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {16044D2B-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {16044D2B-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {16044D2B-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {16044D2B-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {95C06600-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {95C06600-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {95C06600-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {95C06600-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU {89049BBC-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {89049BBC-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {89049BBC-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -140,26 +94,14 @@ Global {B37B02AD-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {B37B02AD-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU {B37B02AD-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {2867B4B3-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2867B4B3-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2867B4B3-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2867B4B3-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU {58443010-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {58443010-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {58443010-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU {58443010-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {AC949F03-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AC949F03-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AC949F03-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AC949F03-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU {9F71FDB3-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {9F71FDB3-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {9F71FDB3-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU {9F71FDB3-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU - {CF93CDA8-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CF93CDA8-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CF93CDA8-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CF93CDA8-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU {EE4EA934-0000-0000-0000-000000000000}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {EE4EA934-0000-0000-0000-000000000000}.Debug|Any CPU.Build.0 = Debug|Any CPU {EE4EA934-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -169,4 +111,7 @@ Global {455B06F4-0000-0000-0000-000000000000}.Release|Any CPU.ActiveCfg = Release|Any CPU {455B06F4-0000-0000-0000-000000000000}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection EndGlobal diff --git a/Programs/AvatarPreview/AvatarPreview.csproj b/Programs/AvatarPreview/AvatarPreview.csproj deleted file mode 100644 index f30d1383..00000000 --- a/Programs/AvatarPreview/AvatarPreview.csproj +++ /dev/null @@ -1,157 +0,0 @@ - - - Local - 14.0.25123 - 2.0 - {93CEA633-0000-0000-0000-000000000000} - Debug - - - - - AvatarPreview - JScript - Grid - IE50 - false - v4.0 - WinExe - - - AvatarPreview - - - - - - - - - True - 285212672 - False - - - TRACE;DEBUG - - - True - 4096 - False - ..\..\bin\ - False - False - False - 4 - False - 1591,1574,0419,0618 - AnyCPU - - - True - 285212672 - False - - - TRACE - - - False - 4096 - True - ..\..\bin\ - False - False - False - 4 - False - 1591,1574,0419,0618 - AnyCPU - - - - ..\..\packages\OpenTK.2.0.0\lib\net20\OpenTK.dll - - - ..\..\packages\OpenTK.GLControl.1.1.2349.61993\lib\NET40\OpenTK.GLControl.dll - - - System - False - - - System.Data - False - - - System.Drawing - False - - - System.Windows.Forms - False - - - System.Xml - False - - - - - LibreMetaverse - {27C70F3A-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - LibreMetaverseTypes - {B37B02AD-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Form - - - Code - - - Code - - - Code - - - Code - - - frmAvatar.cs - - - frmAvatar.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - - - - - - - - - - - - - diff --git a/Programs/AvatarPreview/GLMesh.cs b/Programs/AvatarPreview/GLMesh.cs deleted file mode 100644 index 95b76bf8..00000000 --- a/Programs/AvatarPreview/GLMesh.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; - -using OpenMetaverse; -using OpenMetaverse.Rendering; - -namespace AvatarPreview -{ - /// - /// Subclass of LindenMesh that adds vertex, index, and texture coordinate - /// arrays suitable for pushing direct to OpenGL - /// - public class GLMesh : LindenMesh - { - /// - /// Subclass of LODMesh that adds an index array suitable for pushing - /// direct to OpenGL - /// - public new class LODMesh : LindenMesh.LODMesh - { - public ushort[] Indices; - - public override void LoadMesh(string filename) - { - base.LoadMesh(filename); - - // Generate the index array - Indices = new ushort[_numFaces * 3]; - var current = 0; - for (var i = 0; i < _numFaces; i++) - { - Indices[current++] = (ushort)_faces[i].Indices[0]; - Indices[current++] = (ushort)_faces[i].Indices[1]; - Indices[current++] = (ushort)_faces[i].Indices[2]; - } - } - } - - /// - /// - /// - public struct GLData - { - public float[] Vertices; - public ushort[] Indices; - public float[] TexCoords; - public Vector3 Center; - } - - public GLData RenderData; - - public GLMesh(string name) - : base(name) - { - } - - public override void LoadMesh(string filename) - { - base.LoadMesh(filename); - - float minY, minZ; - var minX = minY = minZ = Single.MaxValue; - float maxY, maxZ; - var maxX = maxY = maxZ = Single.MinValue; - - // Generate the vertex array - RenderData.Vertices = new float[NumVertices * 3]; - int current = 0; - for (int i = 0; i < NumVertices; i++) - { - RenderData.Vertices[current++] = Vertices[i].Coord.X; - RenderData.Vertices[current++] = Vertices[i].Coord.Y; - RenderData.Vertices[current++] = Vertices[i].Coord.Z; - - if (Vertices[i].Coord.X < minX) - minX = Vertices[i].Coord.X; - else if (Vertices[i].Coord.X > maxX) - maxX = Vertices[i].Coord.X; - - if (Vertices[i].Coord.Y < minY) - minY = Vertices[i].Coord.Y; - else if (Vertices[i].Coord.Y > maxY) - maxY = Vertices[i].Coord.Y; - - if (Vertices[i].Coord.Z < minZ) - minZ = Vertices[i].Coord.Z; - else if (Vertices[i].Coord.Z > maxZ) - maxZ = Vertices[i].Coord.Z; - } - - // Calculate the center-point from the bounding box edges - RenderData.Center = new Vector3((minX + maxX) / 2, (minY + maxY) / 2, (minZ + maxZ) / 2); - - // Generate the index array - RenderData.Indices = new ushort[NumFaces * 3]; - current = 0; - for (int i = 0; i < NumFaces; i++) - { - RenderData.Indices[current++] = (ushort)Faces[i].Indices[0]; - RenderData.Indices[current++] = (ushort)Faces[i].Indices[1]; - RenderData.Indices[current++] = (ushort)Faces[i].Indices[2]; - } - - // Generate the texcoord array - RenderData.TexCoords = new float[NumVertices * 2]; - current = 0; - for (int i = 0; i < NumVertices; i++) - { - RenderData.TexCoords[current++] = Vertices[i].TexCoord.X; - RenderData.TexCoords[current++] = Vertices[i].TexCoord.Y; - } - } - - [Obsolete] - public override void LoadLODMesh(int level, string filename) - { - LODMesh lod = new LODMesh(); - lod.LoadMesh(filename); - LodMeshes[level] = lod; - } - } -} diff --git a/Programs/AvatarPreview/Program.cs b/Programs/AvatarPreview/Program.cs deleted file mode 100644 index 51b8edff..00000000 --- a/Programs/AvatarPreview/Program.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; - -namespace AvatarPreview -{ - internal static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - public static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new frmAvatar()); - } - } -} \ No newline at end of file diff --git a/Programs/AvatarPreview/Properties/AssemblyInfo.cs b/Programs/AvatarPreview/Properties/AssemblyInfo.cs deleted file mode 100644 index 95726c51..00000000 --- a/Programs/AvatarPreview/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("avatarpreview")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Millions Of Us")] -[assembly: AssemblyProduct("avatarpreview")] -[assembly: AssemblyCopyright("Copyright © Millions Of Us 2008")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("00d5c128-fce6-4b58-b3b1-cad43b25ee0b")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Programs/AvatarPreview/Properties/Resources.Designer.cs b/Programs/AvatarPreview/Properties/Resources.Designer.cs deleted file mode 100644 index efaa44ac..00000000 --- a/Programs/AvatarPreview/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.1433 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace AvatarPreview.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("avatarpreview.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/Programs/AvatarPreview/Properties/Resources.resx b/Programs/AvatarPreview/Properties/Resources.resx deleted file mode 100644 index ffecec85..00000000 --- a/Programs/AvatarPreview/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Programs/AvatarPreview/Properties/Settings.Designer.cs b/Programs/AvatarPreview/Properties/Settings.Designer.cs deleted file mode 100644 index 7b0838d0..00000000 --- a/Programs/AvatarPreview/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.1433 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace AvatarPreview.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/Programs/AvatarPreview/app.config b/Programs/AvatarPreview/app.config deleted file mode 100644 index d4f722e0..00000000 --- a/Programs/AvatarPreview/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/Programs/AvatarPreview/frmAvatar.Designer.cs b/Programs/AvatarPreview/frmAvatar.Designer.cs deleted file mode 100644 index 2e3dec86..00000000 --- a/Programs/AvatarPreview/frmAvatar.Designer.cs +++ /dev/null @@ -1,1161 +0,0 @@ -namespace AvatarPreview -{ - partial class frmAvatar - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.menu = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.opToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.lindenLabMeshToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.textureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); - this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.wireframeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.glControl = new OpenTK.GLControl(); - this.tabControl = new System.Windows.Forms.TabControl(); - this.tavView = new System.Windows.Forms.TabPage(); - this.scrollZoom = new System.Windows.Forms.HScrollBar(); - this.label18 = new System.Windows.Forms.Label(); - this.label17 = new System.Windows.Forms.Label(); - this.label16 = new System.Windows.Forms.Label(); - this.label15 = new System.Windows.Forms.Label(); - this.scrollRoll = new System.Windows.Forms.HScrollBar(); - this.scrollPitch = new System.Windows.Forms.HScrollBar(); - this.scrollYaw = new System.Windows.Forms.HScrollBar(); - this.tabMorphs = new System.Windows.Forms.TabPage(); - this.splitContainer2 = new System.Windows.Forms.SplitContainer(); - this.lstMorphs = new System.Windows.Forms.ListBox(); - this.tabTextures = new System.Windows.Forms.TabPage(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.lblSkirt = new System.Windows.Forms.Label(); - this.lblLower = new System.Windows.Forms.Label(); - this.lblUpper = new System.Windows.Forms.Label(); - this.lblEyes = new System.Windows.Forms.Label(); - this.lblHead = new System.Windows.Forms.Label(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.picHeadBodypaint = new System.Windows.Forms.PictureBox(); - this.label1 = new System.Windows.Forms.Label(); - this.picHair = new System.Windows.Forms.PictureBox(); - this.label2 = new System.Windows.Forms.Label(); - this.picHeadBake = new System.Windows.Forms.PictureBox(); - this.flowLayoutPanel2 = new System.Windows.Forms.FlowLayoutPanel(); - this.picEyesBake = new System.Windows.Forms.PictureBox(); - this.flowLayoutPanel3 = new System.Windows.Forms.FlowLayoutPanel(); - this.picUpperBodypaint = new System.Windows.Forms.PictureBox(); - this.label3 = new System.Windows.Forms.Label(); - this.picUpperGloves = new System.Windows.Forms.PictureBox(); - this.label4 = new System.Windows.Forms.Label(); - this.picUpperUndershirt = new System.Windows.Forms.PictureBox(); - this.label5 = new System.Windows.Forms.Label(); - this.picUpperShirt = new System.Windows.Forms.PictureBox(); - this.label6 = new System.Windows.Forms.Label(); - this.picUpperJacket = new System.Windows.Forms.PictureBox(); - this.label7 = new System.Windows.Forms.Label(); - this.picUpperBodyBake = new System.Windows.Forms.PictureBox(); - this.flowLayoutPanel4 = new System.Windows.Forms.FlowLayoutPanel(); - this.picLowerBodypaint = new System.Windows.Forms.PictureBox(); - this.label8 = new System.Windows.Forms.Label(); - this.picLowerUnderpants = new System.Windows.Forms.PictureBox(); - this.label9 = new System.Windows.Forms.Label(); - this.picLowerSocks = new System.Windows.Forms.PictureBox(); - this.label10 = new System.Windows.Forms.Label(); - this.picLowerShoes = new System.Windows.Forms.PictureBox(); - this.label11 = new System.Windows.Forms.Label(); - this.picLowerPants = new System.Windows.Forms.PictureBox(); - this.label12 = new System.Windows.Forms.Label(); - this.picLowerJacket = new System.Windows.Forms.PictureBox(); - this.label13 = new System.Windows.Forms.Label(); - this.picLowerBodyBake = new System.Windows.Forms.PictureBox(); - this.flowLayoutPanel5 = new System.Windows.Forms.FlowLayoutPanel(); - this.picSkirtBake = new System.Windows.Forms.PictureBox(); - this.tabAnimations = new System.Windows.Forms.TabPage(); - this.button1 = new System.Windows.Forms.Button(); - this.label14 = new System.Windows.Forms.Label(); - this.textBox1 = new System.Windows.Forms.TextBox(); - this.skirtToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolTip = new System.Windows.Forms.ToolTip(this.components); - this.menu.SuspendLayout(); - this.splitContainer1.Panel1.SuspendLayout(); - this.splitContainer1.Panel2.SuspendLayout(); - this.splitContainer1.SuspendLayout(); - this.tabControl.SuspendLayout(); - this.tavView.SuspendLayout(); - this.tabMorphs.SuspendLayout(); - this.splitContainer2.Panel1.SuspendLayout(); - this.splitContainer2.SuspendLayout(); - this.tabTextures.SuspendLayout(); - this.tableLayoutPanel1.SuspendLayout(); - this.flowLayoutPanel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picHeadBodypaint)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.picHair)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.picHeadBake)).BeginInit(); - this.flowLayoutPanel2.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picEyesBake)).BeginInit(); - this.flowLayoutPanel3.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picUpperBodypaint)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.picUpperGloves)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.picUpperUndershirt)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.picUpperShirt)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.picUpperJacket)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.picUpperBodyBake)).BeginInit(); - this.flowLayoutPanel4.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerBodypaint)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerUnderpants)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerSocks)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerShoes)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerPants)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerJacket)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerBodyBake)).BeginInit(); - this.flowLayoutPanel5.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picSkirtBake)).BeginInit(); - this.tabAnimations.SuspendLayout(); - this.SuspendLayout(); - // - // menu - // - this.menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem, - this.viewToolStripMenuItem, - this.helpToolStripMenuItem}); - this.menu.Location = new System.Drawing.Point(0, 0); - this.menu.Name = "menu"; - this.menu.Size = new System.Drawing.Size(1117, 24); - this.menu.TabIndex = 1; - this.menu.Text = "menu"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.opToolStripMenuItem, - this.toolStripMenuItem2, - this.exitToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(35, 20); - this.fileToolStripMenuItem.Text = "File"; - // - // opToolStripMenuItem - // - this.opToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.lindenLabMeshToolStripMenuItem, - this.textureToolStripMenuItem}); - this.opToolStripMenuItem.Name = "opToolStripMenuItem"; - this.opToolStripMenuItem.Size = new System.Drawing.Size(111, 22); - this.opToolStripMenuItem.Text = "Open"; - // - // lindenLabMeshToolStripMenuItem - // - this.lindenLabMeshToolStripMenuItem.Name = "lindenLabMeshToolStripMenuItem"; - this.lindenLabMeshToolStripMenuItem.Size = new System.Drawing.Size(123, 22); - this.lindenLabMeshToolStripMenuItem.Text = "Avatar"; - this.lindenLabMeshToolStripMenuItem.Click += new System.EventHandler(this.lindenLabMeshToolStripMenuItem_Click); - // - // textureToolStripMenuItem - // - this.textureToolStripMenuItem.Name = "textureToolStripMenuItem"; - this.textureToolStripMenuItem.Size = new System.Drawing.Size(123, 22); - this.textureToolStripMenuItem.Text = "Texture"; - this.textureToolStripMenuItem.Click += new System.EventHandler(this.textureToolStripMenuItem_Click); - // - // toolStripMenuItem2 - // - this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(108, 6); - // - // exitToolStripMenuItem - // - this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(111, 22); - this.exitToolStripMenuItem.Text = "Exit"; - this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); - // - // viewToolStripMenuItem - // - this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.wireframeToolStripMenuItem, - this.skirtToolStripMenuItem}); - this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; - this.viewToolStripMenuItem.Size = new System.Drawing.Size(41, 20); - this.viewToolStripMenuItem.Text = "View"; - // - // wireframeToolStripMenuItem - // - this.wireframeToolStripMenuItem.Checked = true; - this.wireframeToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.wireframeToolStripMenuItem.Name = "wireframeToolStripMenuItem"; - this.wireframeToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.wireframeToolStripMenuItem.Text = "Wireframe"; - this.wireframeToolStripMenuItem.Click += new System.EventHandler(this.wireframeToolStripMenuItem_Click); - // - // helpToolStripMenuItem - // - this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.aboutToolStripMenuItem}); - this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; - this.helpToolStripMenuItem.Size = new System.Drawing.Size(40, 20); - this.helpToolStripMenuItem.Text = "Help"; - // - // aboutToolStripMenuItem - // - this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(114, 22); - this.aboutToolStripMenuItem.Text = "About"; - this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); - // - // splitContainer1 - // - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.Location = new System.Drawing.Point(0, 24); - this.splitContainer1.Name = "splitContainer1"; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.glControl); - // - // splitContainer1.Panel2 - // - this.splitContainer1.Panel2.Controls.Add(this.tabControl); - this.splitContainer1.Size = new System.Drawing.Size(1117, 653); - this.splitContainer1.SplitterDistance = 558; - this.splitContainer1.TabIndex = 2; - // - // glControl - // - this.glControl.BackColor = System.Drawing.Color.Black; - this.glControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.glControl.Location = new System.Drawing.Point(0, 0); - this.glControl.Name = "glControl"; - this.glControl.Size = new System.Drawing.Size(558, 653); - this.glControl.TabIndex = 0; - this.glControl.Paint += new System.Windows.Forms.PaintEventHandler(this.glControl_Paint); - this.glControl.Resize += new System.EventHandler(this.glControl_Resize); - // - // tabControl - // - this.tabControl.Controls.Add(this.tavView); - this.tabControl.Controls.Add(this.tabMorphs); - this.tabControl.Controls.Add(this.tabTextures); - this.tabControl.Controls.Add(this.tabAnimations); - this.tabControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControl.Location = new System.Drawing.Point(0, 0); - this.tabControl.Name = "tabControl"; - this.tabControl.SelectedIndex = 0; - this.tabControl.Size = new System.Drawing.Size(555, 653); - this.tabControl.TabIndex = 0; - // - // tavView - // - this.tavView.Controls.Add(this.scrollZoom); - this.tavView.Controls.Add(this.label18); - this.tavView.Controls.Add(this.label17); - this.tavView.Controls.Add(this.label16); - this.tavView.Controls.Add(this.label15); - this.tavView.Controls.Add(this.scrollRoll); - this.tavView.Controls.Add(this.scrollPitch); - this.tavView.Controls.Add(this.scrollYaw); - this.tavView.Location = new System.Drawing.Point(4, 22); - this.tavView.Name = "tavView"; - this.tavView.Size = new System.Drawing.Size(547, 627); - this.tavView.TabIndex = 3; - this.tavView.Text = "View"; - this.tavView.UseVisualStyleBackColor = true; - // - // scrollZoom - // - this.scrollZoom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.scrollZoom.Location = new System.Drawing.Point(57, 85); - this.scrollZoom.Minimum = -200; - this.scrollZoom.Name = "scrollZoom"; - this.scrollZoom.Size = new System.Drawing.Size(442, 16); - this.scrollZoom.TabIndex = 25; - this.scrollZoom.Value = -50; - this.scrollZoom.ValueChanged += new System.EventHandler(this.scroll_ValueChanged); - // - // label18 - // - this.label18.AutoSize = true; - this.label18.Location = new System.Drawing.Point(11, 88); - this.label18.Name = "label18"; - this.label18.Size = new System.Drawing.Size(37, 13); - this.label18.TabIndex = 24; - this.label18.Text = "Zoom:"; - // - // label17 - // - this.label17.AutoSize = true; - this.label17.Location = new System.Drawing.Point(11, 63); - this.label17.Name = "label17"; - this.label17.Size = new System.Drawing.Size(31, 13); - this.label17.TabIndex = 23; - this.label17.Text = "Yaw:"; - // - // label16 - // - this.label16.AutoSize = true; - this.label16.Location = new System.Drawing.Point(11, 38); - this.label16.Name = "label16"; - this.label16.Size = new System.Drawing.Size(34, 13); - this.label16.TabIndex = 22; - this.label16.Text = "Pitch:"; - // - // label15 - // - this.label15.AutoSize = true; - this.label15.Location = new System.Drawing.Point(11, 10); - this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(28, 13); - this.label15.TabIndex = 21; - this.label15.Text = "Roll:"; - // - // scrollRoll - // - this.scrollRoll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.scrollRoll.Location = new System.Drawing.Point(57, 10); - this.scrollRoll.Maximum = 360; - this.scrollRoll.Name = "scrollRoll"; - this.scrollRoll.Size = new System.Drawing.Size(442, 16); - this.scrollRoll.TabIndex = 12; - this.scrollRoll.ValueChanged += new System.EventHandler(this.scroll_ValueChanged); - // - // scrollPitch - // - this.scrollPitch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.scrollPitch.Location = new System.Drawing.Point(57, 35); - this.scrollPitch.Maximum = 360; - this.scrollPitch.Name = "scrollPitch"; - this.scrollPitch.Size = new System.Drawing.Size(442, 16); - this.scrollPitch.TabIndex = 13; - this.scrollPitch.ValueChanged += new System.EventHandler(this.scroll_ValueChanged); - // - // scrollYaw - // - this.scrollYaw.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.scrollYaw.Location = new System.Drawing.Point(57, 60); - this.scrollYaw.Maximum = 360; - this.scrollYaw.Name = "scrollYaw"; - this.scrollYaw.Size = new System.Drawing.Size(442, 16); - this.scrollYaw.TabIndex = 14; - this.scrollYaw.ValueChanged += new System.EventHandler(this.scroll_ValueChanged); - // - // tabMorphs - // - this.tabMorphs.Controls.Add(this.splitContainer2); - this.tabMorphs.Location = new System.Drawing.Point(4, 22); - this.tabMorphs.Name = "tabMorphs"; - this.tabMorphs.Padding = new System.Windows.Forms.Padding(3); - this.tabMorphs.Size = new System.Drawing.Size(547, 627); - this.tabMorphs.TabIndex = 0; - this.tabMorphs.Text = "Morphs"; - this.tabMorphs.UseVisualStyleBackColor = true; - // - // splitContainer2 - // - this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer2.Location = new System.Drawing.Point(3, 3); - this.splitContainer2.Name = "splitContainer2"; - // - // splitContainer2.Panel1 - // - this.splitContainer2.Panel1.Controls.Add(this.lstMorphs); - this.splitContainer2.Size = new System.Drawing.Size(541, 621); - this.splitContainer2.SplitterDistance = 180; - this.splitContainer2.TabIndex = 0; - // - // lstMorphs - // - this.lstMorphs.Dock = System.Windows.Forms.DockStyle.Fill; - this.lstMorphs.FormattingEnabled = true; - this.lstMorphs.Location = new System.Drawing.Point(0, 0); - this.lstMorphs.Name = "lstMorphs"; - this.lstMorphs.Size = new System.Drawing.Size(180, 615); - this.lstMorphs.TabIndex = 0; - // - // tabTextures - // - this.tabTextures.Controls.Add(this.tableLayoutPanel1); - this.tabTextures.Location = new System.Drawing.Point(4, 22); - this.tabTextures.Name = "tabTextures"; - this.tabTextures.Padding = new System.Windows.Forms.Padding(3); - this.tabTextures.Size = new System.Drawing.Size(547, 627); - this.tabTextures.TabIndex = 1; - this.tabTextures.Text = "Textures"; - this.tabTextures.UseVisualStyleBackColor = true; - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 1; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Controls.Add(this.lblSkirt, 0, 8); - this.tableLayoutPanel1.Controls.Add(this.lblLower, 0, 6); - this.tableLayoutPanel1.Controls.Add(this.lblUpper, 0, 4); - this.tableLayoutPanel1.Controls.Add(this.lblEyes, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.lblHead, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel2, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel3, 0, 5); - this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel4, 0, 7); - this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel5, 0, 9); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 10; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 75F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 75F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 75F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(541, 621); - this.tableLayoutPanel1.TabIndex = 0; - // - // lblSkirt - // - this.lblSkirt.AutoSize = true; - this.lblSkirt.Dock = System.Windows.Forms.DockStyle.Left; - this.lblSkirt.Location = new System.Drawing.Point(3, 526); - this.lblSkirt.Name = "lblSkirt"; - this.lblSkirt.Size = new System.Drawing.Size(28, 20); - this.lblSkirt.TabIndex = 12; - this.lblSkirt.Text = "Skirt"; - this.lblSkirt.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // lblLower - // - this.lblLower.AutoSize = true; - this.lblLower.Dock = System.Windows.Forms.DockStyle.Left; - this.lblLower.Location = new System.Drawing.Point(3, 358); - this.lblLower.Name = "lblLower"; - this.lblLower.Size = new System.Drawing.Size(36, 20); - this.lblLower.TabIndex = 10; - this.lblLower.Text = "Lower"; - this.lblLower.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // lblUpper - // - this.lblUpper.AutoSize = true; - this.lblUpper.Dock = System.Windows.Forms.DockStyle.Left; - this.lblUpper.Location = new System.Drawing.Point(3, 190); - this.lblUpper.Name = "lblUpper"; - this.lblUpper.Size = new System.Drawing.Size(36, 20); - this.lblUpper.TabIndex = 8; - this.lblUpper.Text = "Upper"; - this.lblUpper.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // lblEyes - // - this.lblEyes.AutoSize = true; - this.lblEyes.Dock = System.Windows.Forms.DockStyle.Left; - this.lblEyes.Location = new System.Drawing.Point(3, 95); - this.lblEyes.Name = "lblEyes"; - this.lblEyes.Size = new System.Drawing.Size(30, 20); - this.lblEyes.TabIndex = 6; - this.lblEyes.Text = "Eyes"; - this.lblEyes.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // lblHead - // - this.lblHead.AutoSize = true; - this.lblHead.Dock = System.Windows.Forms.DockStyle.Left; - this.lblHead.Location = new System.Drawing.Point(3, 0); - this.lblHead.Name = "lblHead"; - this.lblHead.Size = new System.Drawing.Size(33, 20); - this.lblHead.TabIndex = 0; - this.lblHead.Text = "Head"; - this.lblHead.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // flowLayoutPanel1 - // - this.flowLayoutPanel1.Controls.Add(this.picHeadBodypaint); - this.flowLayoutPanel1.Controls.Add(this.label1); - this.flowLayoutPanel1.Controls.Add(this.picHair); - this.flowLayoutPanel1.Controls.Add(this.label2); - this.flowLayoutPanel1.Controls.Add(this.picHeadBake); - this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel1.Location = new System.Drawing.Point(3, 23); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(535, 69); - this.flowLayoutPanel1.TabIndex = 13; - // - // picHeadBodypaint - // - this.picHeadBodypaint.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picHeadBodypaint.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picHeadBodypaint.Cursor = System.Windows.Forms.Cursors.Hand; - this.picHeadBodypaint.Location = new System.Drawing.Point(3, 3); - this.picHeadBodypaint.Name = "picHeadBodypaint"; - this.picHeadBodypaint.Size = new System.Drawing.Size(64, 64); - this.picHeadBodypaint.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picHeadBodypaint.TabIndex = 0; - this.picHeadBodypaint.TabStop = false; - this.picHeadBodypaint.Tag = "Head"; - this.toolTip.SetToolTip(this.picHeadBodypaint, "Head Bodypaint"); - this.picHeadBodypaint.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // label1 - // - this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(73, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(13, 70); - this.label1.TabIndex = 1; - this.label1.Text = "+"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // picHair - // - this.picHair.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picHair.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picHair.Cursor = System.Windows.Forms.Cursors.Hand; - this.picHair.Location = new System.Drawing.Point(92, 3); - this.picHair.Name = "picHair"; - this.picHair.Size = new System.Drawing.Size(64, 64); - this.picHair.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picHair.TabIndex = 2; - this.picHair.TabStop = false; - this.picHair.Tag = "Head"; - this.toolTip.SetToolTip(this.picHair, "Hair"); - this.picHair.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // label2 - // - this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(162, 0); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(13, 70); - this.label2.TabIndex = 3; - this.label2.Text = "="; - this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // picHeadBake - // - this.picHeadBake.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picHeadBake.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picHeadBake.Cursor = System.Windows.Forms.Cursors.Hand; - this.picHeadBake.Location = new System.Drawing.Point(181, 3); - this.picHeadBake.Name = "picHeadBake"; - this.picHeadBake.Size = new System.Drawing.Size(64, 64); - this.picHeadBake.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picHeadBake.TabIndex = 4; - this.picHeadBake.TabStop = false; - this.picHeadBake.Tag = "Bake"; - this.toolTip.SetToolTip(this.picHeadBake, "Head Final Bake"); - this.picHeadBake.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // flowLayoutPanel2 - // - this.flowLayoutPanel2.Controls.Add(this.picEyesBake); - this.flowLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel2.Location = new System.Drawing.Point(3, 118); - this.flowLayoutPanel2.Name = "flowLayoutPanel2"; - this.flowLayoutPanel2.Size = new System.Drawing.Size(535, 69); - this.flowLayoutPanel2.TabIndex = 14; - // - // picEyesBake - // - this.picEyesBake.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picEyesBake.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picEyesBake.Cursor = System.Windows.Forms.Cursors.Hand; - this.picEyesBake.Location = new System.Drawing.Point(3, 3); - this.picEyesBake.Name = "picEyesBake"; - this.picEyesBake.Size = new System.Drawing.Size(64, 64); - this.picEyesBake.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picEyesBake.TabIndex = 1; - this.picEyesBake.TabStop = false; - this.picEyesBake.Tag = "Bake"; - this.toolTip.SetToolTip(this.picEyesBake, "Eyes Final Bake"); - this.picEyesBake.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // flowLayoutPanel3 - // - this.flowLayoutPanel3.Controls.Add(this.picUpperBodypaint); - this.flowLayoutPanel3.Controls.Add(this.label3); - this.flowLayoutPanel3.Controls.Add(this.picUpperGloves); - this.flowLayoutPanel3.Controls.Add(this.label4); - this.flowLayoutPanel3.Controls.Add(this.picUpperUndershirt); - this.flowLayoutPanel3.Controls.Add(this.label5); - this.flowLayoutPanel3.Controls.Add(this.picUpperShirt); - this.flowLayoutPanel3.Controls.Add(this.label6); - this.flowLayoutPanel3.Controls.Add(this.picUpperJacket); - this.flowLayoutPanel3.Controls.Add(this.label7); - this.flowLayoutPanel3.Controls.Add(this.picUpperBodyBake); - this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel3.Location = new System.Drawing.Point(3, 213); - this.flowLayoutPanel3.Name = "flowLayoutPanel3"; - this.flowLayoutPanel3.Size = new System.Drawing.Size(535, 142); - this.flowLayoutPanel3.TabIndex = 15; - // - // picUpperBodypaint - // - this.picUpperBodypaint.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picUpperBodypaint.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picUpperBodypaint.Cursor = System.Windows.Forms.Cursors.Hand; - this.picUpperBodypaint.Location = new System.Drawing.Point(3, 3); - this.picUpperBodypaint.Name = "picUpperBodypaint"; - this.picUpperBodypaint.Size = new System.Drawing.Size(64, 64); - this.picUpperBodypaint.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picUpperBodypaint.TabIndex = 3; - this.picUpperBodypaint.TabStop = false; - this.picUpperBodypaint.Tag = "Upper"; - this.toolTip.SetToolTip(this.picUpperBodypaint, "Upper Bodypaint"); - this.picUpperBodypaint.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // label3 - // - this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(73, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(13, 70); - this.label3.TabIndex = 4; - this.label3.Text = "+"; - this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // picUpperGloves - // - this.picUpperGloves.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picUpperGloves.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picUpperGloves.Cursor = System.Windows.Forms.Cursors.Hand; - this.picUpperGloves.Location = new System.Drawing.Point(92, 3); - this.picUpperGloves.Name = "picUpperGloves"; - this.picUpperGloves.Size = new System.Drawing.Size(64, 64); - this.picUpperGloves.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picUpperGloves.TabIndex = 5; - this.picUpperGloves.TabStop = false; - this.picUpperGloves.Tag = "Upper"; - this.toolTip.SetToolTip(this.picUpperGloves, "Gloves"); - this.picUpperGloves.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // label4 - // - this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(162, 0); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(13, 70); - this.label4.TabIndex = 6; - this.label4.Text = "+"; - this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // picUpperUndershirt - // - this.picUpperUndershirt.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picUpperUndershirt.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picUpperUndershirt.Cursor = System.Windows.Forms.Cursors.Hand; - this.picUpperUndershirt.Location = new System.Drawing.Point(181, 3); - this.picUpperUndershirt.Name = "picUpperUndershirt"; - this.picUpperUndershirt.Size = new System.Drawing.Size(64, 64); - this.picUpperUndershirt.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picUpperUndershirt.TabIndex = 7; - this.picUpperUndershirt.TabStop = false; - this.picUpperUndershirt.Tag = "Upper"; - this.toolTip.SetToolTip(this.picUpperUndershirt, "Undershirt"); - this.picUpperUndershirt.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // label5 - // - this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(251, 0); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(13, 70); - this.label5.TabIndex = 8; - this.label5.Text = "+"; - this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // picUpperShirt - // - this.picUpperShirt.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picUpperShirt.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picUpperShirt.Cursor = System.Windows.Forms.Cursors.Hand; - this.picUpperShirt.Location = new System.Drawing.Point(270, 3); - this.picUpperShirt.Name = "picUpperShirt"; - this.picUpperShirt.Size = new System.Drawing.Size(64, 64); - this.picUpperShirt.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picUpperShirt.TabIndex = 9; - this.picUpperShirt.TabStop = false; - this.picUpperShirt.Tag = "Upper"; - this.toolTip.SetToolTip(this.picUpperShirt, "Shirt"); - this.picUpperShirt.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // label6 - // - this.label6.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(340, 0); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(13, 70); - this.label6.TabIndex = 10; - this.label6.Text = "+"; - this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // picUpperJacket - // - this.picUpperJacket.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picUpperJacket.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picUpperJacket.Cursor = System.Windows.Forms.Cursors.Hand; - this.picUpperJacket.Location = new System.Drawing.Point(359, 3); - this.picUpperJacket.Name = "picUpperJacket"; - this.picUpperJacket.Size = new System.Drawing.Size(64, 64); - this.picUpperJacket.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picUpperJacket.TabIndex = 11; - this.picUpperJacket.TabStop = false; - this.picUpperJacket.Tag = "Upper"; - this.toolTip.SetToolTip(this.picUpperJacket, "Jacket"); - this.picUpperJacket.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // label7 - // - this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(429, 0); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(13, 70); - this.label7.TabIndex = 12; - this.label7.Text = "="; - this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // picUpperBodyBake - // - this.picUpperBodyBake.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picUpperBodyBake.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picUpperBodyBake.Cursor = System.Windows.Forms.Cursors.Hand; - this.picUpperBodyBake.Location = new System.Drawing.Point(448, 3); - this.picUpperBodyBake.Name = "picUpperBodyBake"; - this.picUpperBodyBake.Size = new System.Drawing.Size(64, 64); - this.picUpperBodyBake.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picUpperBodyBake.TabIndex = 13; - this.picUpperBodyBake.TabStop = false; - this.picUpperBodyBake.Tag = "Bake"; - this.toolTip.SetToolTip(this.picUpperBodyBake, "Upper Final Bake"); - this.picUpperBodyBake.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // flowLayoutPanel4 - // - this.flowLayoutPanel4.Controls.Add(this.picLowerBodypaint); - this.flowLayoutPanel4.Controls.Add(this.label8); - this.flowLayoutPanel4.Controls.Add(this.picLowerUnderpants); - this.flowLayoutPanel4.Controls.Add(this.label9); - this.flowLayoutPanel4.Controls.Add(this.picLowerSocks); - this.flowLayoutPanel4.Controls.Add(this.label10); - this.flowLayoutPanel4.Controls.Add(this.picLowerShoes); - this.flowLayoutPanel4.Controls.Add(this.label11); - this.flowLayoutPanel4.Controls.Add(this.picLowerPants); - this.flowLayoutPanel4.Controls.Add(this.label12); - this.flowLayoutPanel4.Controls.Add(this.picLowerJacket); - this.flowLayoutPanel4.Controls.Add(this.label13); - this.flowLayoutPanel4.Controls.Add(this.picLowerBodyBake); - this.flowLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel4.Location = new System.Drawing.Point(3, 381); - this.flowLayoutPanel4.Name = "flowLayoutPanel4"; - this.flowLayoutPanel4.Size = new System.Drawing.Size(535, 142); - this.flowLayoutPanel4.TabIndex = 16; - // - // picLowerBodypaint - // - this.picLowerBodypaint.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picLowerBodypaint.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picLowerBodypaint.Cursor = System.Windows.Forms.Cursors.Hand; - this.picLowerBodypaint.Location = new System.Drawing.Point(3, 3); - this.picLowerBodypaint.Name = "picLowerBodypaint"; - this.picLowerBodypaint.Size = new System.Drawing.Size(64, 64); - this.picLowerBodypaint.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picLowerBodypaint.TabIndex = 14; - this.picLowerBodypaint.TabStop = false; - this.picLowerBodypaint.Tag = "Lower"; - this.toolTip.SetToolTip(this.picLowerBodypaint, "Lower Bodypaint"); - this.picLowerBodypaint.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // label8 - // - this.label8.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(73, 0); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(13, 70); - this.label8.TabIndex = 15; - this.label8.Text = "+"; - this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // picLowerUnderpants - // - this.picLowerUnderpants.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picLowerUnderpants.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picLowerUnderpants.Cursor = System.Windows.Forms.Cursors.Hand; - this.picLowerUnderpants.Location = new System.Drawing.Point(92, 3); - this.picLowerUnderpants.Name = "picLowerUnderpants"; - this.picLowerUnderpants.Size = new System.Drawing.Size(64, 64); - this.picLowerUnderpants.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picLowerUnderpants.TabIndex = 16; - this.picLowerUnderpants.TabStop = false; - this.picLowerUnderpants.Tag = "Lower"; - this.toolTip.SetToolTip(this.picLowerUnderpants, "Underpants"); - this.picLowerUnderpants.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // label9 - // - this.label9.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(162, 0); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(13, 70); - this.label9.TabIndex = 17; - this.label9.Text = "+"; - this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // picLowerSocks - // - this.picLowerSocks.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picLowerSocks.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picLowerSocks.Cursor = System.Windows.Forms.Cursors.Hand; - this.picLowerSocks.Location = new System.Drawing.Point(181, 3); - this.picLowerSocks.Name = "picLowerSocks"; - this.picLowerSocks.Size = new System.Drawing.Size(64, 64); - this.picLowerSocks.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picLowerSocks.TabIndex = 18; - this.picLowerSocks.TabStop = false; - this.picLowerSocks.Tag = "Lower"; - this.toolTip.SetToolTip(this.picLowerSocks, "Socks"); - this.picLowerSocks.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // label10 - // - this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); - this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(251, 0); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(13, 70); - this.label10.TabIndex = 19; - this.label10.Text = "+"; - this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // picLowerShoes - // - this.picLowerShoes.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picLowerShoes.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picLowerShoes.Cursor = System.Windows.Forms.Cursors.Hand; - this.picLowerShoes.Location = new System.Drawing.Point(270, 3); - this.picLowerShoes.Name = "picLowerShoes"; - this.picLowerShoes.Size = new System.Drawing.Size(64, 64); - this.picLowerShoes.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picLowerShoes.TabIndex = 20; - this.picLowerShoes.TabStop = false; - this.picLowerShoes.Tag = "Lower"; - this.toolTip.SetToolTip(this.picLowerShoes, "Shoes"); - this.picLowerShoes.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // label11 - // - this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(340, 0); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(13, 70); - this.label11.TabIndex = 21; - this.label11.Text = "+"; - this.label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // picLowerPants - // - this.picLowerPants.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picLowerPants.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picLowerPants.Cursor = System.Windows.Forms.Cursors.Hand; - this.picLowerPants.Location = new System.Drawing.Point(359, 3); - this.picLowerPants.Name = "picLowerPants"; - this.picLowerPants.Size = new System.Drawing.Size(64, 64); - this.picLowerPants.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picLowerPants.TabIndex = 22; - this.picLowerPants.TabStop = false; - this.picLowerPants.Tag = "Lower"; - this.toolTip.SetToolTip(this.picLowerPants, "Pants"); - this.picLowerPants.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // label12 - // - this.label12.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(429, 0); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(13, 70); - this.label12.TabIndex = 23; - this.label12.Text = "+"; - this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // picLowerJacket - // - this.picLowerJacket.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picLowerJacket.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picLowerJacket.Cursor = System.Windows.Forms.Cursors.Hand; - this.picLowerJacket.Location = new System.Drawing.Point(448, 3); - this.picLowerJacket.Name = "picLowerJacket"; - this.picLowerJacket.Size = new System.Drawing.Size(64, 64); - this.picLowerJacket.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picLowerJacket.TabIndex = 24; - this.picLowerJacket.TabStop = false; - this.picLowerJacket.Tag = "Lower"; - this.toolTip.SetToolTip(this.picLowerJacket, "Jacket"); - this.picLowerJacket.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // label13 - // - this.label13.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom))); - this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(518, 0); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(13, 70); - this.label13.TabIndex = 25; - this.label13.Text = "="; - this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // picLowerBodyBake - // - this.picLowerBodyBake.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.picLowerBodyBake.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picLowerBodyBake.Cursor = System.Windows.Forms.Cursors.Hand; - this.picLowerBodyBake.Location = new System.Drawing.Point(3, 73); - this.picLowerBodyBake.Name = "picLowerBodyBake"; - this.picLowerBodyBake.Size = new System.Drawing.Size(64, 64); - this.picLowerBodyBake.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picLowerBodyBake.TabIndex = 26; - this.picLowerBodyBake.TabStop = false; - this.picLowerBodyBake.Tag = "Bake"; - this.toolTip.SetToolTip(this.picLowerBodyBake, "Lower Final Bake"); - this.picLowerBodyBake.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pic_MouseClick); - // - // flowLayoutPanel5 - // - this.flowLayoutPanel5.Controls.Add(this.picSkirtBake); - this.flowLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel5.Location = new System.Drawing.Point(3, 549); - this.flowLayoutPanel5.Name = "flowLayoutPanel5"; - this.flowLayoutPanel5.Size = new System.Drawing.Size(535, 69); - this.flowLayoutPanel5.TabIndex = 17; - // - // picSkirtBake - // - this.picSkirtBake.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.picSkirtBake.Location = new System.Drawing.Point(3, 3); - this.picSkirtBake.Name = "picSkirtBake"; - this.picSkirtBake.Size = new System.Drawing.Size(64, 64); - this.picSkirtBake.TabIndex = 2; - this.picSkirtBake.TabStop = false; - this.picSkirtBake.Tag = "Bake"; - this.toolTip.SetToolTip(this.picSkirtBake, "Skirt Final Bake"); - // - // tabAnimations - // - this.tabAnimations.Controls.Add(this.button1); - this.tabAnimations.Controls.Add(this.label14); - this.tabAnimations.Controls.Add(this.textBox1); - this.tabAnimations.Location = new System.Drawing.Point(4, 22); - this.tabAnimations.Name = "tabAnimations"; - this.tabAnimations.Size = new System.Drawing.Size(547, 627); - this.tabAnimations.TabIndex = 2; - this.tabAnimations.Text = "Animations"; - this.tabAnimations.UseVisualStyleBackColor = true; - // - // button1 - // - this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button1.Location = new System.Drawing.Point(464, 20); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); - this.button1.TabIndex = 2; - this.button1.Text = "Browse..."; - this.button1.UseVisualStyleBackColor = true; - // - // label14 - // - this.label14.AutoSize = true; - this.label14.Location = new System.Drawing.Point(7, 7); - this.label14.Name = "label14"; - this.label14.Size = new System.Drawing.Size(168, 13); - this.label14.TabIndex = 1; - this.label14.Text = "Animation File (.animation or .bvh):"; - // - // textBox1 - // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.Location = new System.Drawing.Point(10, 23); - this.textBox1.Name = "textBox1"; - this.textBox1.Size = new System.Drawing.Size(448, 20); - this.textBox1.TabIndex = 0; - // - // skirtToolStripMenuItem - // - this.skirtToolStripMenuItem.Name = "skirtToolStripMenuItem"; - this.skirtToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.skirtToolStripMenuItem.Text = "Skirt"; - this.skirtToolStripMenuItem.Click += new System.EventHandler(this.skirtToolStripMenuItem_Click); - // - // frmAvatar - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1117, 677); - this.Controls.Add(this.splitContainer1); - this.Controls.Add(this.menu); - this.Name = "frmAvatar"; - this.Text = "Avatar Preview"; - this.menu.ResumeLayout(false); - this.menu.PerformLayout(); - this.splitContainer1.Panel1.ResumeLayout(false); - this.splitContainer1.Panel2.ResumeLayout(false); - this.splitContainer1.ResumeLayout(false); - this.tabControl.ResumeLayout(false); - this.tavView.ResumeLayout(false); - this.tavView.PerformLayout(); - this.tabMorphs.ResumeLayout(false); - this.splitContainer2.Panel1.ResumeLayout(false); - this.splitContainer2.ResumeLayout(false); - this.tabTextures.ResumeLayout(false); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.flowLayoutPanel1.ResumeLayout(false); - this.flowLayoutPanel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picHeadBodypaint)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.picHair)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.picHeadBake)).EndInit(); - this.flowLayoutPanel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.picEyesBake)).EndInit(); - this.flowLayoutPanel3.ResumeLayout(false); - this.flowLayoutPanel3.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picUpperBodypaint)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.picUpperGloves)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.picUpperUndershirt)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.picUpperShirt)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.picUpperJacket)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.picUpperBodyBake)).EndInit(); - this.flowLayoutPanel4.ResumeLayout(false); - this.flowLayoutPanel4.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerBodypaint)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerUnderpants)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerSocks)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerShoes)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerPants)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerJacket)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.picLowerBodyBake)).EndInit(); - this.flowLayoutPanel5.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.picSkirtBake)).EndInit(); - this.tabAnimations.ResumeLayout(false); - this.tabAnimations.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.MenuStrip menu; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem opToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem lindenLabMeshToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem textureToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; - private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem wireframeToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; - private System.Windows.Forms.SplitContainer splitContainer1; - private OpenTK.GLControl glControl; - private System.Windows.Forms.TabControl tabControl; - private System.Windows.Forms.TabPage tabMorphs; - private System.Windows.Forms.TabPage tabTextures; - private System.Windows.Forms.TabPage tabAnimations; - private System.Windows.Forms.SplitContainer splitContainer2; - private System.Windows.Forms.ListBox lstMorphs; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.Label lblUpper; - private System.Windows.Forms.Label lblEyes; - private System.Windows.Forms.Label lblHead; - private System.Windows.Forms.Label lblSkirt; - private System.Windows.Forms.Label lblLower; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; - private System.Windows.Forms.PictureBox picHeadBodypaint; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel2; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel3; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel4; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel5; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.PictureBox picHair; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.PictureBox picHeadBake; - private System.Windows.Forms.PictureBox picEyesBake; - private System.Windows.Forms.PictureBox picUpperBodypaint; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.PictureBox picUpperGloves; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.PictureBox picUpperUndershirt; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.PictureBox picUpperShirt; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.PictureBox picUpperJacket; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.PictureBox picUpperBodyBake; - private System.Windows.Forms.PictureBox picLowerBodypaint; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.PictureBox picLowerUnderpants; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.PictureBox picLowerSocks; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.PictureBox picLowerShoes; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.PictureBox picLowerPants; - private System.Windows.Forms.Label label12; - private System.Windows.Forms.PictureBox picLowerJacket; - private System.Windows.Forms.Label label13; - private System.Windows.Forms.PictureBox picLowerBodyBake; - private System.Windows.Forms.PictureBox picSkirtBake; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Label label14; - private System.Windows.Forms.TextBox textBox1; - private System.Windows.Forms.TabPage tavView; - private System.Windows.Forms.HScrollBar scrollRoll; - private System.Windows.Forms.HScrollBar scrollPitch; - private System.Windows.Forms.HScrollBar scrollYaw; - private System.Windows.Forms.HScrollBar scrollZoom; - private System.Windows.Forms.Label label18; - private System.Windows.Forms.Label label17; - private System.Windows.Forms.Label label16; - private System.Windows.Forms.Label label15; - private System.Windows.Forms.ToolStripMenuItem skirtToolStripMenuItem; - private System.Windows.Forms.ToolTip toolTip; - } -} - diff --git a/Programs/AvatarPreview/frmAvatar.cs b/Programs/AvatarPreview/frmAvatar.cs deleted file mode 100644 index f3a6a0ea..00000000 --- a/Programs/AvatarPreview/frmAvatar.cs +++ /dev/null @@ -1,449 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Windows.Forms; -using System.IO; -using System.Xml; - -using OpenTK.Graphics.OpenGL; - -using OpenMetaverse; -using OpenMetaverse.Imaging; -using OpenMetaverse.Assets; - -namespace AvatarPreview -{ - public partial class frmAvatar : Form - { - GridClient _client = new GridClient(); - Dictionary _meshes = new Dictionary(); - bool _wireframe = true; - bool _showSkirt = false; - - public frmAvatar() - { - InitializeComponent(); - - GL.ShadeModel(ShadingModel.Smooth); - GL.ClearColor(Color.Black); - GL.ClearDepth(1.0f); - GL.Enable(EnableCap.DepthTest); - GL.DepthMask(true); - GL.DepthFunc(DepthFunction.Lequal); - GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); - - glControl_Resize(null, null); - } - - private void lindenLabMeshToolStripMenuItem_Click(object sender, EventArgs e) - { - var dialog = new OpenFileDialog {Filter = @"avatar_lad.xml|avatar_lad.xml"}; - - if (dialog.ShowDialog() != DialogResult.OK) return; - - _meshes.Clear(); - - try - { - // Parse through avatar_lad.xml to find all of the mesh references - XmlDocument lad = new XmlDocument(); - lad.Load(dialog.FileName); - - XmlNodeList meshes = lad.GetElementsByTagName("mesh"); - - foreach (XmlNode meshNode in meshes) - { - string type = meshNode.Attributes.GetNamedItem("type").Value; - int lod = Int32.Parse(meshNode.Attributes.GetNamedItem("lod").Value); - string fileName = meshNode.Attributes.GetNamedItem("file_name").Value; - //string minPixelWidth = meshNode.Attributes.GetNamedItem("min_pixel_width").Value; - - // Mash up the filename with the current path - fileName = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(dialog.FileName), fileName); - - GLMesh mesh = (_meshes.ContainsKey(type) ? _meshes[type] : new GLMesh(type)); - - if (lod == 0) - { - mesh.LoadMesh(fileName); - } - else - { - mesh.LoadLODMesh(lod, fileName); - } - - _meshes[type] = mesh; - glControl_Resize(null, null); - glControl.Invalidate(); - } - } - catch (Exception ex) - { - MessageBox.Show(@"Failed to load avatar mesh: " + ex.Message); - } - } - - private void textureToolStripMenuItem_Click(object sender, EventArgs e) - { - - } - - private void exitToolStripMenuItem_Click(object sender, EventArgs e) - { - - } - - private void wireframeToolStripMenuItem_Click(object sender, EventArgs e) - { - wireframeToolStripMenuItem.Checked = !wireframeToolStripMenuItem.Checked; - _wireframe = wireframeToolStripMenuItem.Checked; - - glControl.Invalidate(); - } - - private void skirtToolStripMenuItem_Click(object sender, EventArgs e) - { - skirtToolStripMenuItem.Checked = !skirtToolStripMenuItem.Checked; - _showSkirt = skirtToolStripMenuItem.Checked; - - glControl.Invalidate(); - } - - private void aboutToolStripMenuItem_Click(object sender, EventArgs e) - { - MessageBox.Show( - @"Written by John Hurliman (http://www.jhurliman.org/)"); - } - - private void glControl_Paint(object sender, PaintEventArgs e) - { - GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); - GL.LoadIdentity(); - if (_wireframe) - GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); - else - GL.PolygonMode(MaterialFace.Front, PolygonMode.Fill); - // Push the world matrix - GL.PushMatrix(); - GL.EnableClientState(ArrayCap.VertexArray); - GL.EnableClientState(ArrayCap.TextureCoordArray); - // World rotations - GL.Rotate(scrollRoll.Value, 1f, 0f, 0f); - GL.Rotate(scrollRoll.Value, 0f, 1f, 0f); - GL.Rotate(scrollRoll.Value, 0f, 0f, 1f); - - if (_meshes.Count > 0) - { - foreach (GLMesh mesh in _meshes.Values) - { - if (!_showSkirt && mesh.Name == "skirtMesh") - continue; - - GL.Color3(1f, 1f, 1f); - - // Individual prim matrix - GL.PushMatrix(); - - //Gl.glTranslatef(mesh.Position.X, mesh.Position.Y, mesh.Position.Z); - - GL.Rotate(mesh.RotationAngles.X, 1f, 0f, 0f); - GL.Rotate(mesh.RotationAngles.Y, 0f, 1f, 0f); - GL.Rotate(mesh.RotationAngles.Z, 0f, 0f, 1f); - - GL.Scale(mesh.Scale.X, mesh.Scale.Y, mesh.Scale.Z); - - // TODO: Texturing - - GL.TexCoordPointer(2, TexCoordPointerType.Float, 0, mesh.RenderData.TexCoords); - GL.VertexPointer(3, VertexPointerType.Float, 0, mesh.RenderData.TexCoords); - GL.DrawElements(BeginMode.Triangles, mesh.RenderData.Indices.Length, DrawElementsType.UnsignedShort, mesh.RenderData.Indices); - } - } - - // Pop the world matrix - GL.PopMatrix(); - - GL.DisableClientState(ArrayCap.TextureCoordArray); - GL.DisableClientState(ArrayCap.VertexArray); - - GL.Flush(); - } - - private void glControl_Resize(object sender, EventArgs e) - { - //GL.ClearColor(0.39f, 0.58f, 0.93f, 1.0f); // Cornflower blue anyone? - GL.ClearColor(0f, 0f, 0f, 1f); - - GL.PushMatrix(); - GL.MatrixMode(MatrixMode.Projection); - GL.LoadIdentity(); - - GL.Viewport(0, 0, glControl.Width, glControl.Height); - - OpenTK.Matrix4 perspectiveMatrix = OpenTK.Matrix4.CreatePerspectiveFieldOfView(50.0f, 1.0f, 0.001f, 50f); - GL.LoadMatrix(ref perspectiveMatrix); - - Vector3 center = Vector3.Zero; - GLMesh head, lowerBody; - if (_meshes.TryGetValue("headMesh", out head) && _meshes.TryGetValue("lowerBodyMesh", out lowerBody)) - center = (head.RenderData.Center + lowerBody.RenderData.Center) / 2f; - - OpenTK.Matrix4 lookAt = OpenTK.Matrix4.LookAt( - new OpenTK.Vector3(center.X, scrollZoom.Value * 0.1f + center.Y, center.Z), - new OpenTK.Vector3(center.X, scrollZoom.Value * 0.1f + center.Y + 1f, center.Z), - new OpenTK.Vector3(0f, 0f, 1f)); - GL.LoadMatrix(ref lookAt); - GL.MatrixMode(MatrixMode.Modelview); - } - - private void scroll_ValueChanged(object sender, EventArgs e) - { - glControl_Resize(null, null); - glControl.Invalidate(); - } - - private void pic_MouseClick(object sender, MouseEventArgs e) - { - PictureBox control = (PictureBox)sender; - - OpenFileDialog dialog = new OpenFileDialog(); - // TODO: Setup a dialog.Filter for supported image types - - if (dialog.ShowDialog() == DialogResult.OK) - { - try - { - Image image = Image.FromFile(dialog.FileName); - - #region Dimensions Check - - if (control == picEyesBake) - { - // Eyes texture is 128x128 - if (Width != 128 || Height != 128) - { - Bitmap resized = new Bitmap(128, 128, image.PixelFormat); - Graphics graphics = Graphics.FromImage(resized); - - graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; - graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; - graphics.DrawImage(image, 0, 0, 128, 128); - - image.Dispose(); - image = resized; - } - } - else - { - // Other textures are 512x512 - if (Width != 128 || Height != 128) - { - Bitmap resized = new Bitmap(512, 512, image.PixelFormat); - Graphics graphics = Graphics.FromImage(resized); - - graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; - graphics.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; - graphics.DrawImage(image, 0, 0, 512, 512); - - image.Dispose(); - image = resized; - } - } - - #endregion Dimensions Check - - // Set the control image - control.Image = image; - } - catch (Exception ex) - { - MessageBox.Show(@"Failed to load image: " + ex.Message); - } - } - else - { - control.Image = null; - } - - #region Baking - - var paramValues = GetParamValues(); - var layers = - new Dictionary(); - int textureCount = 0; - - if ((string)control.Tag == "Head") - { - if (picHair.Image != null) - { - layers.Add(AvatarTextureIndex.Hair, - new AssetTexture(new ManagedImage((Bitmap)picHair.Image))); - ++textureCount; - } - if (picHeadBodypaint.Image != null) - { - layers.Add(AvatarTextureIndex.HeadBodypaint, - new AssetTexture(new ManagedImage((Bitmap)picHeadBodypaint.Image))); - ++textureCount; - } - - // Compute the head bake - Baker baker = new Baker(BakeType.Head); - - foreach (var kvp in layers) - { - AppearanceManager.TextureData tdata = new AppearanceManager.TextureData {Texture = kvp.Value}; - baker.AddTexture(tdata); - } - - baker.Bake(); - - if (baker.BakedTexture != null) - { - AssetTexture bakeAsset = baker.BakedTexture; - // Baked textures use the alpha layer for other purposes, so we need to not use it - bakeAsset.Image.Channels = ManagedImage.ImageChannels.Color; - picHeadBake.Image = LoadTGAClass.LoadTGA(new MemoryStream(bakeAsset.Image.ExportTGA())); - } - else - { - MessageBox.Show(@"Failed to create the bake layer, unknown error"); - } - } - else if ((string)control.Tag == "Upper") - { - if (picUpperBodypaint.Image != null) - { - layers.Add(AvatarTextureIndex.UpperBodypaint, - new AssetTexture(new ManagedImage((Bitmap)picUpperBodypaint.Image))); - ++textureCount; - } - if (picUpperGloves.Image != null) - { - layers.Add(AvatarTextureIndex.UpperGloves, - new AssetTexture(new ManagedImage((Bitmap)picUpperGloves.Image))); - ++textureCount; - } - if (picUpperUndershirt.Image != null) - { - layers.Add(AvatarTextureIndex.UpperUndershirt, - new AssetTexture(new ManagedImage((Bitmap)picUpperUndershirt.Image))); - ++textureCount; - } - if (picUpperShirt.Image != null) - { - layers.Add(AvatarTextureIndex.UpperShirt, - new AssetTexture(new ManagedImage((Bitmap)picUpperShirt.Image))); - ++textureCount; - } - if (picUpperJacket.Image != null) - { - layers.Add(AvatarTextureIndex.UpperJacket, - new AssetTexture(new ManagedImage((Bitmap)picUpperJacket.Image))); - ++textureCount; - } - - // Compute the upper body bake - Baker baker = new Baker(BakeType.UpperBody); - - foreach (KeyValuePair kvp in layers) - { - AppearanceManager.TextureData tdata = new AppearanceManager.TextureData(); - tdata.Texture = kvp.Value; - baker.AddTexture(tdata); - } - - baker.Bake(); - - if (baker.BakedTexture != null) - { - AssetTexture bakeAsset = baker.BakedTexture; - // Baked textures use the alpha layer for other purposes, so we need to not use it - bakeAsset.Image.Channels = ManagedImage.ImageChannels.Color; - picUpperBodyBake.Image = LoadTGAClass.LoadTGA(new MemoryStream(bakeAsset.Image.ExportTGA())); - } - else - { - MessageBox.Show(@"Failed to create the bake layer, unknown error"); - } - } - else if ((string)control.Tag == "Lower") - { - if (picLowerBodypaint.Image != null) - { - layers.Add(AvatarTextureIndex.LowerBodypaint, - new AssetTexture(new ManagedImage((Bitmap)picLowerBodypaint.Image))); - ++textureCount; - } - if (picLowerUnderpants.Image != null) - { - layers.Add(AvatarTextureIndex.LowerUnderpants, - new AssetTexture(new ManagedImage((Bitmap)picLowerUnderpants.Image))); - ++textureCount; - } - if (picLowerSocks.Image != null) - { - layers.Add(AvatarTextureIndex.LowerSocks, - new AssetTexture(new ManagedImage((Bitmap)picLowerSocks.Image))); - ++textureCount; - } - if (picLowerShoes.Image != null) - { - layers.Add(AvatarTextureIndex.LowerShoes, - new AssetTexture(new ManagedImage((Bitmap)picLowerShoes.Image))); - ++textureCount; - } - if (picLowerPants.Image != null) - { - layers.Add(AvatarTextureIndex.LowerPants, - new AssetTexture(new ManagedImage((Bitmap)picLowerPants.Image))); - ++textureCount; - } - - // Compute the lower body bake - Baker baker = new Baker(BakeType.LowerBody); - - foreach (KeyValuePair kvp in layers) - { - AppearanceManager.TextureData tdata = new AppearanceManager.TextureData(); - tdata.Texture = kvp.Value; - baker.AddTexture(tdata); - } - - baker.Bake(); - - if (baker.BakedTexture != null) - { - AssetTexture bakeAsset = baker.BakedTexture; - // Baked textures use the alpha layer for other purposes, so we need to not use it - bakeAsset.Image.Channels = ManagedImage.ImageChannels.Color; - picLowerBodyBake.Image = LoadTGAClass.LoadTGA(new MemoryStream(bakeAsset.Image.ExportTGA())); - } - else - { - MessageBox.Show(@"Failed to create the bake layer, unknown error"); - } - } - else if ((string)control.Tag == "Bake") - { - // Bake image has been set manually, no need to manually calculate a bake - // FIXME: - } - - #endregion Baking - } - - private Dictionary GetParamValues() - { - var paramValues = new Dictionary(VisualParams.Params.Count); - - foreach (var kvp in VisualParams.Params) - { - VisualParam vp = kvp.Value; - paramValues.Add(vp.ParamID, vp.DefaultValue); - } - - return paramValues; - } - } -} diff --git a/Programs/AvatarPreview/frmAvatar.resx b/Programs/AvatarPreview/frmAvatar.resx deleted file mode 100644 index c85db068..00000000 --- a/Programs/AvatarPreview/frmAvatar.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 96, 17 - - \ No newline at end of file diff --git a/Programs/AvatarPreview/packages.config b/Programs/AvatarPreview/packages.config deleted file mode 100644 index 44488244..00000000 --- a/Programs/AvatarPreview/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Programs/GridImageUpload/GridImageUpload.cs b/Programs/GridImageUpload/GridImageUpload.cs deleted file mode 100644 index be197c34..00000000 --- a/Programs/GridImageUpload/GridImageUpload.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; - -namespace GridImageUpload -{ - static class GridImageUpload - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new frmGridImageUpload()); - } - } -} \ No newline at end of file diff --git a/Programs/GridImageUpload/GridImageUpload.csproj b/Programs/GridImageUpload/GridImageUpload.csproj deleted file mode 100644 index b699d50c..00000000 --- a/Programs/GridImageUpload/GridImageUpload.csproj +++ /dev/null @@ -1,133 +0,0 @@ - - - Local - 14.0.25123 - 2.0 - {06BD6C42-0000-0000-0000-000000000000} - Debug - - - - GridImageUpload - JScript - Grid - IE50 - false - v4.0 - WinExe - - GridImageUpload - - - - - - - True - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\bin\ - False - False - False - 4 - False - 1591,1574,0419 - AnyCPU - - - True - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\bin\ - False - False - False - 4 - False - 1591,1574,0419 - AnyCPU - - - - System - False - - - System.Data - False - - - System.Drawing - False - - - System.Windows.Forms - False - - - - - LibreMetaverse - {27C70F3A-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - LibreMetaverseTypes - {B37B02AD-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - Code - - - Code - - - Code - - - frmGridImageUpload.cs - - - frmGridImageUpload.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - - - - - - - - diff --git a/Programs/GridImageUpload/Properties/AssemblyInfo.cs b/Programs/GridImageUpload/Properties/AssemblyInfo.cs deleted file mode 100644 index 8cb2dbf7..00000000 --- a/Programs/GridImageUpload/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("GridImageUpload")] -[assembly: AssemblyDescription("JPEG2000 compressor and texture uploader for virtual worlds")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Open Metaverse Foundation")] -[assembly: AssemblyProduct("GridImageUpload")] -[assembly: AssemblyCopyright("Copyright © Open Metaverse Foundation")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d8a0ec17-daf9-4a17-b72f-d32ed7f6962a")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.4.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Programs/GridImageUpload/Properties/Resources.Designer.cs b/Programs/GridImageUpload/Properties/Resources.Designer.cs deleted file mode 100644 index 13781231..00000000 --- a/Programs/GridImageUpload/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace GridImageUpload.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GridImageUpload.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/Programs/GridImageUpload/Properties/Resources.resx b/Programs/GridImageUpload/Properties/Resources.resx deleted file mode 100644 index ffecec85..00000000 --- a/Programs/GridImageUpload/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Programs/GridImageUpload/Properties/Settings.Designer.cs b/Programs/GridImageUpload/Properties/Settings.Designer.cs deleted file mode 100644 index c2a71e12..00000000 --- a/Programs/GridImageUpload/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace SLImageUpload.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/Programs/GridImageUpload/frmGridImageUpload.Designer.cs b/Programs/GridImageUpload/frmGridImageUpload.Designer.cs deleted file mode 100644 index b2750e27..00000000 --- a/Programs/GridImageUpload/frmGridImageUpload.Designer.cs +++ /dev/null @@ -1,314 +0,0 @@ -namespace GridImageUpload -{ - partial class frmGridImageUpload - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.grpLogin = new System.Windows.Forms.GroupBox(); - this.label5 = new System.Windows.Forms.Label(); - this.cboLoginURL = new System.Windows.Forms.ComboBox(); - this.cmdConnect = new System.Windows.Forms.Button(); - this.label3 = new System.Windows.Forms.Label(); - this.txtPassword = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.txtLastName = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.txtFirstName = new System.Windows.Forms.TextBox(); - this.grpUpload = new System.Windows.Forms.GroupBox(); - this.txtAssetID = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.lblSize = new System.Windows.Forms.Label(); - this.prgUpload = new System.Windows.Forms.ProgressBar(); - this.picPreview = new System.Windows.Forms.PictureBox(); - this.cmdLoad = new System.Windows.Forms.Button(); - this.txtSendtoName = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); - this.chkLossless = new System.Windows.Forms.CheckBox(); - this.cmdUpload = new System.Windows.Forms.Button(); - this.cmdSave = new System.Windows.Forms.Button(); - this.grpLogin.SuspendLayout(); - this.grpUpload.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picPreview)).BeginInit(); - this.SuspendLayout(); - // - // grpLogin - // - this.grpLogin.Controls.Add(this.label5); - this.grpLogin.Controls.Add(this.cboLoginURL); - this.grpLogin.Controls.Add(this.cmdConnect); - this.grpLogin.Controls.Add(this.label3); - this.grpLogin.Controls.Add(this.txtPassword); - this.grpLogin.Controls.Add(this.label2); - this.grpLogin.Controls.Add(this.txtLastName); - this.grpLogin.Controls.Add(this.label1); - this.grpLogin.Controls.Add(this.txtFirstName); - this.grpLogin.Location = new System.Drawing.Point(11, 260); - this.grpLogin.Name = "grpLogin"; - this.grpLogin.Size = new System.Drawing.Size(379, 145); - this.grpLogin.TabIndex = 67; - this.grpLogin.TabStop = false; - // - // label5 - // - this.label5.Location = new System.Drawing.Point(6, 65); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(120, 16); - this.label5.TabIndex = 74; - this.label5.Text = "Login URL"; - // - // cboLoginURL - // - this.cboLoginURL.FormattingEnabled = true; - this.cboLoginURL.Location = new System.Drawing.Point(6, 84); - this.cboLoginURL.Name = "cboLoginURL"; - this.cboLoginURL.Size = new System.Drawing.Size(365, 21); - this.cboLoginURL.TabIndex = 3; - // - // cmdConnect - // - this.cmdConnect.Location = new System.Drawing.Point(251, 111); - this.cmdConnect.Name = "cmdConnect"; - this.cmdConnect.Size = new System.Drawing.Size(120, 24); - this.cmdConnect.TabIndex = 4; - this.cmdConnect.Text = "Connect"; - this.cmdConnect.Click += new System.EventHandler(this.cmdConnect_Click); - // - // label3 - // - this.label3.Location = new System.Drawing.Point(251, 20); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(120, 16); - this.label3.TabIndex = 72; - this.label3.Text = "Password"; - // - // txtPassword - // - this.txtPassword.Location = new System.Drawing.Point(251, 36); - this.txtPassword.Name = "txtPassword"; - this.txtPassword.PasswordChar = '*'; - this.txtPassword.Size = new System.Drawing.Size(120, 20); - this.txtPassword.TabIndex = 2; - // - // label2 - // - this.label2.Location = new System.Drawing.Point(132, 20); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(120, 16); - this.label2.TabIndex = 70; - this.label2.Text = "Last Name"; - // - // txtLastName - // - this.txtLastName.Location = new System.Drawing.Point(132, 36); - this.txtLastName.Name = "txtLastName"; - this.txtLastName.Size = new System.Drawing.Size(112, 20); - this.txtLastName.TabIndex = 1; - // - // label1 - // - this.label1.Location = new System.Drawing.Point(6, 20); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(120, 16); - this.label1.TabIndex = 68; - this.label1.Text = "First Name"; - // - // txtFirstName - // - this.txtFirstName.Location = new System.Drawing.Point(6, 36); - this.txtFirstName.Name = "txtFirstName"; - this.txtFirstName.Size = new System.Drawing.Size(120, 20); - this.txtFirstName.TabIndex = 0; - // - // grpUpload - // - this.grpUpload.Controls.Add(this.cmdSave); - this.grpUpload.Controls.Add(this.txtAssetID); - this.grpUpload.Controls.Add(this.label4); - this.grpUpload.Controls.Add(this.lblSize); - this.grpUpload.Controls.Add(this.prgUpload); - this.grpUpload.Controls.Add(this.picPreview); - this.grpUpload.Controls.Add(this.cmdLoad); - this.grpUpload.Controls.Add(this.txtSendtoName); - this.grpUpload.Controls.Add(this.label6); - this.grpUpload.Controls.Add(this.chkLossless); - this.grpUpload.Controls.Add(this.cmdUpload); - this.grpUpload.Location = new System.Drawing.Point(12, 12); - this.grpUpload.Name = "grpUpload"; - this.grpUpload.Size = new System.Drawing.Size(379, 242); - this.grpUpload.TabIndex = 68; - this.grpUpload.TabStop = false; - // - // txtAssetID - // - this.txtAssetID.Location = new System.Drawing.Point(90, 204); - this.txtAssetID.Name = "txtAssetID"; - this.txtAssetID.ReadOnly = true; - this.txtAssetID.Size = new System.Drawing.Size(280, 20); - this.txtAssetID.TabIndex = 10; - this.txtAssetID.TabStop = false; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(6, 207); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(66, 13); - this.label4.TabIndex = 79; - this.label4.Text = "Asset UUID:"; - // - // lblSize - // - this.lblSize.AutoSize = true; - this.lblSize.Location = new System.Drawing.Point(79, 96); - this.lblSize.Name = "lblSize"; - this.lblSize.Size = new System.Drawing.Size(0, 13); - this.lblSize.TabIndex = 77; - // - // prgUpload - // - this.prgUpload.Location = new System.Drawing.Point(9, 175); - this.prgUpload.Name = "prgUpload"; - this.prgUpload.Size = new System.Drawing.Size(362, 23); - this.prgUpload.TabIndex = 76; - // - // picPreview - // - this.picPreview.Location = new System.Drawing.Point(9, 96); - this.picPreview.Name = "picPreview"; - this.picPreview.Size = new System.Drawing.Size(64, 64); - this.picPreview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picPreview.TabIndex = 75; - this.picPreview.TabStop = false; - // - // cmdLoad - // - this.cmdLoad.Location = new System.Drawing.Point(86, 136); - this.cmdLoad.Name = "cmdLoad"; - this.cmdLoad.Size = new System.Drawing.Size(91, 24); - this.cmdLoad.TabIndex = 7; - this.cmdLoad.Text = "Load Texture"; - this.cmdLoad.UseVisualStyleBackColor = true; - this.cmdLoad.Click += new System.EventHandler(this.cmdLoad_Click); - // - // txtSendtoName - // - this.txtSendtoName.Location = new System.Drawing.Point(131, 64); - this.txtSendtoName.Name = "txtSendtoName"; - this.txtSendtoName.Size = new System.Drawing.Size(239, 20); - this.txtSendtoName.TabIndex = 6; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(6, 67); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(112, 13); - this.label6.TabIndex = 71; - this.label6.Text = "Send Copy To Avatar:"; - // - // chkLossless - // - this.chkLossless.Location = new System.Drawing.Point(9, 19); - this.chkLossless.Name = "chkLossless"; - this.chkLossless.Size = new System.Drawing.Size(362, 37); - this.chkLossless.TabIndex = 5; - this.chkLossless.Text = "Single Layer Lossless (only useful for pixel perfect reproductions of small image" + - "s, such as sculpt maps)"; - this.chkLossless.UseVisualStyleBackColor = true; - this.chkLossless.CheckedChanged += new System.EventHandler(this.chkLossless_CheckedChanged); - // - // cmdUpload - // - this.cmdUpload.Enabled = false; - this.cmdUpload.Location = new System.Drawing.Point(280, 136); - this.cmdUpload.Name = "cmdUpload"; - this.cmdUpload.Size = new System.Drawing.Size(91, 24); - this.cmdUpload.TabIndex = 9; - this.cmdUpload.Text = "Upload Texture"; - this.cmdUpload.UseVisualStyleBackColor = true; - this.cmdUpload.Click += new System.EventHandler(this.cmdUpload_Click); - // - // cmdSave - // - this.cmdSave.Enabled = false; - this.cmdSave.Location = new System.Drawing.Point(183, 136); - this.cmdSave.Name = "cmdSave"; - this.cmdSave.Size = new System.Drawing.Size(91, 24); - this.cmdSave.TabIndex = 8; - this.cmdSave.Text = "Save Texture"; - this.cmdSave.UseVisualStyleBackColor = true; - this.cmdSave.Click += new System.EventHandler(this.cmdSave_Click); - // - // frmGridImageUpload - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(402, 417); - this.Controls.Add(this.grpUpload); - this.Controls.Add(this.grpLogin); - this.MaximizeBox = false; - this.MinimumSize = new System.Drawing.Size(410, 400); - this.Name = "frmGridImageUpload"; - this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; - this.Text = "Image Upload"; - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmGridImageUpload_FormClosed); - this.grpLogin.ResumeLayout(false); - this.grpLogin.PerformLayout(); - this.grpUpload.ResumeLayout(false); - this.grpUpload.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picPreview)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.GroupBox grpLogin; - private System.Windows.Forms.Button cmdConnect; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox txtPassword; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox txtLastName; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox txtFirstName; - private System.Windows.Forms.GroupBox grpUpload; - private System.Windows.Forms.Button cmdUpload; - private System.Windows.Forms.CheckBox chkLossless; - private System.Windows.Forms.TextBox txtSendtoName; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.PictureBox picPreview; - private System.Windows.Forms.Button cmdLoad; - private System.Windows.Forms.ProgressBar prgUpload; - private System.Windows.Forms.Label lblSize; - private System.Windows.Forms.TextBox txtAssetID; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.ComboBox cboLoginURL; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Button cmdSave; - } -} - diff --git a/Programs/GridImageUpload/frmGridImageUpload.cs b/Programs/GridImageUpload/frmGridImageUpload.cs deleted file mode 100644 index 3f156916..00000000 --- a/Programs/GridImageUpload/frmGridImageUpload.cs +++ /dev/null @@ -1,409 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Text; -using System.Windows.Forms; -using System.Threading; -using OpenMetaverse; -using OpenMetaverse.Http; -using OpenMetaverse.Imaging; - -namespace GridImageUpload -{ - public partial class frmGridImageUpload : Form - { - private GridClient Client; - private byte[] UploadData = null; - private int Transferred = 0; - private string FileName = String.Empty; - private UUID SendToID; - private UUID AssetID; - - public frmGridImageUpload() - { - InitializeComponent(); - - // Add login entries to the login combo box - cboLoginURL.Items.Add(Settings.AGNI_LOGIN_SERVER); - cboLoginURL.Items.Add(Settings.ADITI_LOGIN_SERVER); - cboLoginURL.SelectedIndex = 0; - - InitClient(); - } - - private void InitClient() - { - Client = new GridClient(); - Client.Network.EventQueueRunning += Network_OnEventQueueRunning; - Client.Network.LoginProgress += Network_OnLogin; - - // Turn almost everything off since we are only interested in uploading textures - Settings.LOG_LEVEL = Helpers.LogLevel.None; - Client.Settings.ALWAYS_DECODE_OBJECTS = false; - Client.Settings.ALWAYS_REQUEST_OBJECTS = false; - Client.Settings.SEND_AGENT_UPDATES = true; - Client.Settings.OBJECT_TRACKING = false; - Client.Settings.STORE_LAND_PATCHES = false; - Client.Settings.MULTIPLE_SIMS = false; - Client.Self.Movement.Camera.Far = 32.0f; - Client.Throttle.Cloud = 0.0f; - Client.Throttle.Land = 0.0f; - Client.Throttle.Wind = 0.0f; - - Client.Throttle.Texture = 446000.0f; - } - - private void EnableUpload() - { - if (UploadData != null) - { - if (this.InvokeRequired) - BeginInvoke(new MethodInvoker(EnableUpload)); - else - cmdUpload.Enabled = true; - } - } - - private void DisableUpload() - { - if (this.InvokeRequired) - BeginInvoke(new MethodInvoker(DisableUpload)); - else - cmdUpload.Enabled = false; - } - - private void UpdateAssetID() - { - if (this.InvokeRequired) - BeginInvoke(new MethodInvoker(UpdateAssetID)); - else - txtAssetID.Text = AssetID.ToString(); - } - - private void LoadImage() - { - if (String.IsNullOrEmpty(FileName)) - return; - - string extension = System.IO.Path.GetExtension(FileName).ToLower(); - Bitmap bitmap = null; - - try - { - if (extension == ".jp2" || extension == ".j2c") - { - Image image; - ManagedImage managedImage; - - // Upload JPEG2000 images untouched - UploadData = System.IO.File.ReadAllBytes(FileName); - - OpenJPEG.DecodeToImage(UploadData, out managedImage, out image); - bitmap = (Bitmap)image; - - Logger.Log("Loaded raw JPEG2000 data " + FileName, Helpers.LogLevel.Info, Client); - } - else - { - if (extension == ".tga") - bitmap = LoadTGAClass.LoadTGA(FileName); - else - bitmap = (Bitmap)System.Drawing.Image.FromFile(FileName); - - Logger.Log("Loaded image " + FileName, Helpers.LogLevel.Info, Client); - - int oldwidth = bitmap.Width; - int oldheight = bitmap.Height; - - if (!IsPowerOfTwo((uint)oldwidth) || !IsPowerOfTwo((uint)oldheight)) - { - Logger.Log("Image has irregular dimensions " + oldwidth + "x" + oldheight + ", resizing to 256x256", - Helpers.LogLevel.Info, Client); - - Bitmap resized = new Bitmap(256, 256, bitmap.PixelFormat); - Graphics graphics = Graphics.FromImage(resized); - - graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; - graphics.InterpolationMode = - System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; - graphics.DrawImage(bitmap, 0, 0, 256, 256); - - bitmap.Dispose(); - bitmap = resized; - - oldwidth = 256; - oldheight = 256; - } - - // Handle resizing to prevent excessively large images - if (oldwidth > 1024 || oldheight > 1024) - { - int newwidth = (oldwidth > 1024) ? 1024 : oldwidth; - int newheight = (oldheight > 1024) ? 1024 : oldheight; - - Logger.Log("Image has oversized dimensions " + oldwidth + "x" + oldheight + ", resizing to " + - newwidth + "x" + newheight, Helpers.LogLevel.Info, Client); - - Bitmap resized = new Bitmap(newwidth, newheight, bitmap.PixelFormat); - Graphics graphics = Graphics.FromImage(resized); - - graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; - graphics.InterpolationMode = - System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; - graphics.DrawImage(bitmap, 0, 0, newwidth, newheight); - - bitmap.Dispose(); - bitmap = resized; - } - - Logger.Log("Encoding image...", Helpers.LogLevel.Info, Client); - - UploadData = OpenJPEG.EncodeFromImage(bitmap, chkLossless.Checked); - - Logger.Log("Finished encoding", Helpers.LogLevel.Info, Client); - - //System.IO.File.WriteAllBytes("out.jp2", UploadData); - } - } - catch (Exception ex) - { - UploadData = null; - cmdSave.Enabled = false; - cmdUpload.Enabled = false; - MessageBox.Show(ex.ToString(), "SL Image Upload", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - - picPreview.Image = bitmap; - lblSize.Text = Math.Round((double)UploadData.Length / 1024.0d, 2) + "KB"; - prgUpload.Maximum = UploadData.Length; - - cmdSave.Enabled = true; - if (Client.Network.Connected) cmdUpload.Enabled = true; - } - - private void SaveImage() - { - if (String.IsNullOrEmpty(FileName)) - return; - - if (UploadData != null) - { - try - { - System.IO.File.WriteAllBytes(FileName, UploadData); - MessageBox.Show("Saved " + UploadData.Length + " bytes to " + FileName); - } - catch (Exception ex) - { - MessageBox.Show("Failed to save " + FileName + ": " + ex.Message, Application.ProductName, - MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - } - } - else - { - MessageBox.Show("No image data loaded", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - } - } - - private void cmdConnect_Click(object sender, EventArgs e) - { - if (cmdConnect.Text == "Connect") - { - cmdConnect.Text = "Disconnect"; - cboLoginURL.Enabled = txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = false; - LoginParams lp = Client.Network.DefaultLoginParams(txtFirstName.Text, txtLastName.Text, txtPassword.Text, - "GridImageUpload", Application.ProductVersion); - lp.URI = cboLoginURL.Text; - cmdConnect.Enabled = false; - Client.Network.BeginLogin(lp); - } - else - { - Client.Network.Logout(); - cmdConnect.Text = "Connect"; - cboLoginURL.Enabled = txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = true; - DisableUpload(); - InitClient(); - } - } - - private void Network_OnLogin(object sender, LoginProgressEventArgs e) - { - if (InvokeRequired) - { - BeginInvoke(new MethodInvoker( - delegate() - { - Network_OnLogin(sender, e); - } - )); - return; - } - if (e.Status == LoginStatus.Success) - { - MessageBox.Show("Connected: " + e.Message); - cmdConnect.Enabled = true; - } - else if (e.Status == LoginStatus.Failed) - { - MessageBox.Show(this, String.Format("Error logging in ({0}): {1}", Client.Network.LoginErrorKey, - Client.Network.LoginMessage)); - cmdConnect.Text = "Connect"; - cmdConnect.Enabled = true; - txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = true; - DisableUpload(); - } - - } - - private void cmdLoad_Click(object sender, EventArgs e) - { - OpenFileDialog dialog = new OpenFileDialog(); - dialog.Filter = - "Image Files (*.jp2,*.j2c,*.jpg,*.jpeg,*.gif,*.png,*.bmp,*.tga,*.tif,*.tiff,*.ico,*.wmf,*.emf)|" + - "*.jp2;*.j2c;*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.tga;*.tif;*.tiff;*.ico;*.wmf;*.emf;"; - - if (dialog.ShowDialog() == DialogResult.OK) - { - FileName = dialog.FileName; - LoadImage(); - } - } - - private void cmdSave_Click(object sender, EventArgs e) - { - SaveFileDialog dialog = new SaveFileDialog(); - dialog.Filter = "JPEG2000 File (*.j2c)|*.j2c;"; - - if (dialog.ShowDialog() == DialogResult.OK) - { - FileName = dialog.FileName; - SaveImage(); - } - } - - private void cmdUpload_Click(object sender, EventArgs e) - { - SendToID = UUID.Zero; - string sendTo = txtSendtoName.Text.Trim(); - - if (sendTo.Length > 0) - { - AutoResetEvent lookupEvent = new AutoResetEvent(false); - UUID thisQueryID = UUID.Zero; - bool lookupSuccess = false; - - EventHandler callback = - delegate(object s, DirPeopleReplyEventArgs ep) - { - if (ep.QueryID == thisQueryID) - { - if (ep.MatchedPeople.Count > 0) - { - SendToID = ep.MatchedPeople[0].AgentID; - lookupSuccess = true; - } - - lookupEvent.Set(); - } - }; - - Client.Directory.DirPeopleReply += callback; - thisQueryID = Client.Directory.StartPeopleSearch(sendTo, 0); - - bool eventSuccess = lookupEvent.WaitOne(10 * 1000, false); - Client.Directory.DirPeopleReply -= callback; - - if (eventSuccess && lookupSuccess) - { - Logger.Log("Will send uploaded image to avatar " + SendToID.ToString(), Helpers.LogLevel.Info, Client); - } - else - { - MessageBox.Show("Could not find avatar \"" + sendTo + "\", upload cancelled"); - return; - } - } - - if (UploadData != null) - { - prgUpload.Value = 0; - cmdLoad.Enabled = false; - cmdSave.Enabled = false; - cmdUpload.Enabled = false; - grpLogin.Enabled = false; - - string name = System.IO.Path.GetFileNameWithoutExtension(FileName); - - Permissions perms = new Permissions(); - perms.EveryoneMask = PermissionMask.All; - perms.NextOwnerMask = PermissionMask.All; - - Client.Inventory.RequestCreateItemFromAsset(UploadData, name, "Uploaded with SL Image Upload", AssetType.Texture, - InventoryType.Texture, Client.Inventory.FindFolderForType(AssetType.Texture), perms, - delegate(bool success, string status, UUID itemID, UUID assetID) - { - if (this.InvokeRequired) - BeginInvoke(new MethodInvoker(EnableControls)); - else - EnableControls(); - - if (success) - { - AssetID = assetID; - UpdateAssetID(); - - // Fix the permissions on the new upload since they are fscked by default - InventoryItem item = (InventoryItem)Client.Inventory.Store[itemID]; - - Transferred = UploadData.Length; - BeginInvoke((MethodInvoker)delegate() { SetProgress(); }); - } - else - { - MessageBox.Show("Asset upload failed: " + status); - } - } - ); - } - } - - private void SetProgress() - { - prgUpload.Value = Transferred; - } - - private void Network_OnEventQueueRunning(object sender, EventQueueRunningEventArgs e) - { - Logger.DebugLog("Event queue is running for " + e.Simulator.ToString() + ", enabling uploads", Client); - EnableUpload(); - } - - private void EnableControls() - { - cmdLoad.Enabled = true; - cmdSave.Enabled = true; - cmdUpload.Enabled = true; - grpLogin.Enabled = true; - } - - private void frmGridImageUpload_FormClosed(object sender, FormClosedEventArgs e) - { - if (Client.Network.Connected) - Client.Network.Logout(); - } - - private void chkLossless_CheckedChanged(object sender, EventArgs e) - { - LoadImage(); - } - - private bool IsPowerOfTwo(uint n) - { - return (n & (n - 1)) == 0 && n != 0; - } - } -} diff --git a/Programs/GridImageUpload/frmGridImageUpload.resx b/Programs/GridImageUpload/frmGridImageUpload.resx deleted file mode 100644 index ff31a6db..00000000 --- a/Programs/GridImageUpload/frmGridImageUpload.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Programs/Prebuild/AUTHORS b/Programs/Prebuild/AUTHORS deleted file mode 100644 index d794c5ef..00000000 --- a/Programs/Prebuild/AUTHORS +++ /dev/null @@ -1,7 +0,0 @@ -Dave Hudson (jendave@yahoo.com), -Matthew Holmes (matthew@wildfiregames.com) -Dan Moorehead (dan05a@gmail.com) -Rob Loach (http://www.robloach.net) -C.J. Adams-Collier (cjac@colliertech.org) - - diff --git a/Programs/Prebuild/COPYING b/Programs/Prebuild/COPYING deleted file mode 100644 index d3cdf7e3..00000000 --- a/Programs/Prebuild/COPYING +++ /dev/null @@ -1,65 +0,0 @@ -BSD License -Copyright (c)2004-2008 - -See AUTHORS file for list of copyright holders - -Dave Hudson (jendave@yahoo.com), -Matthew Holmes (matthew@wildfiregames.com) -Dan Moorehead (dan05a@gmail.com) -Rob Loach (http://www.robloach.net) -C.J. Adams-Collier (cjac@colliertech.org) - -http://dnpb.sourceforge.net -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. The names of the authors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - ---- - -Portions of src/Core/Targets/AutotoolsTarget.cs -// Copyright (C) 2006 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Programs/Prebuild/ChangeLog b/Programs/Prebuild/ChangeLog deleted file mode 100644 index bb8e7b09..00000000 --- a/Programs/Prebuild/ChangeLog +++ /dev/null @@ -1,461 +0,0 @@ -2008-12-09T02:15 D. Moonfire - * src/Core/Kernel.cs - - Added a /ppi target to get the results of processing but before - processing the actual results. - * src/Core/Preprocessor.cs - - Applied the patch from kanato with formatting changes. - - Uses the format. - * tests/ - - Added some lightweight tests to test the functionality of the - include patch. - -2008-06-19T09:37 John Anderson - * src/Core/Kernel.cs - - Only Loop through targets that are not abstract. - * src/Core/Targets/VSGenericTarget.cs - - Marked abstract and removed the Target attribute. - -2008-06-16T17:37 John Anderson - * src/Core/Nodes/ProjectNode.cs,data/prebuild-1.7.xsd - - Added the ability to hardcode guid's in the projects - -2008-05-21T0737 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - - catch exception when unable to compile AssemblyInfo.cs - -2008-05-07T17:29 John Anderson - * src/Core/Targets/VSGenericTarget.cs - - Generate asp.net output in bin\ folder (asp.net requires it there) - -2008-04-30T17:29 John Anderson - * src/Core/Nodes/DatabaseReferenceNode.cs, - src/Core/Nodes/Datanode.cs, - src/Core/Nodes/FileNode.cs, - src/Core/Nodes/FileNodes.cs, - src/Core/Nodes/MatchNode.cs, - src/Core/Targets/VS2008Target.cs, - src/data/prebuild-1.7.xsd - - Refactored the project generation code to handle web projects and more - logically handle embedded resources and designer files. - -2008-04-30T17:29 Joseph Lombrozo - * src/Core/Nodes/SolutionNode.cs - - Had solutions inherit Configurations in the same way that Projects do. - -2008-04-29T06:35 Joseph Lombrozo - * src/Core/Targets/VS2008Target.cs, - src/Core/Nodes/DatabaseProjectNode.cs, - src/Core/Nodes/DatabaseReferenceNode.cs, - src/data/prebuild-1.7.xsd - - Added database references to database projects. - - Prevented nested solutions from being written to disk. - -2008-04-29T05:43 Joseph Lombrozo - * src/Core/Targets/VS2008Target.cs - - Enabled embedded solutions to contain Files. - -2008-04-29T04:13 Joseph Lombrozo - * src/Core/VSVersion.cs - - Fixed spelling mistake in enum comment. - * src/Core/Attributes/DataNodeAttribute.cs - - Allowed the DataNodeAttribute to be attached to a single class - more than once, allowing one class to be used to parse more than - one node at a time. - * src/Core/Kernel.cs - - Changed CacheNodeTypes() to allow for multiple DataNodeAttribute - instances in one class. Refactored ProcessFile(...) to return Solutions, - rather than adding them to the Kernel. - * src/Core/Nodes/SolutionNode.cs - - Added Guid (for embedded folders) - - Added DatabaseProjects, Solutions and Processes to the SolutionNode - when parsing. - * src/Core/Nodes/ProjectNode.cs - - Added FrameworkVersion property to allow for 2.0/3.0/3.5 differentiation. - * src/Core/Targets/VS2008Target.cs, src/data/prebuild-1.7.xsd - - Added ability to have embedded solutions, and externally referenced - prebuild scripts. - -2008-04-24T04:33 John M. Anderson - * src/Core/Targets/VS2003Target.cs, src/Core/Targets/VSVersion.cs - - Moved the VSVersion enum into its own file. - * src/Core/Targets/VS2008Target.cs - - added support for VS2008 - * src/Core/Nodes/ProjectNode.cs - - Added initial support for ASP.NET projects - * src/Core/Nodes/DatabaseProjectNode.cs - - Added support for Visual Studio database projects - -2008-02-19T07:08 C.J. Adams-Collier - * TODO - - added some tasks from Sam Hocevar - * src/Core/Targets/AutotoolsTarget.cs - - added a missing end paren - * COPYING - - Removed Randy Ridge's name from the copyright. Looks to me like - his name was present only because the file was nabbed from Tao - -2008-02-09T20:29 C.J. Adams-Collier - * COPYING - - added MIT/X11 license due to inclusion of code from Monodevelop - * THANKS - - added Lluis Sanchez Gual and Todd Berman - I yoinked code from - their pkg-config .pc file parser to build AutotoolsTarget.cs. - Sorry it took me so long to remember to add mention of you guys! - * src/Core/Targets/AutotoolsTarget.cs - - added MIT/X11 license. see above. - -2008-02-07T08:27 C.J. Adams-Collier - * AUTHORS - - consolidated names and contact info found laying around the - source - * src/Core/Kernel.cs - - updated copyright date - - re-formatted license for 80-column editor - - updated log banner to indicate new date, new authors - * src/Core/Targets/AutotoolsTarget.cs - - clarified reasoning behind use of constants in - AutotoolsTarget.ParsePCFile - - reduced length of some long lines using newline/indent - - added log messages for parsing .pc files, emitting solutions, - projects - - robustified the inter-package dependency resolution target - - log warning when we can't find assembly for - - clarified code for case of inability to find embedded - autotools.xml - * src/data/autotools.xml - - adding system lookup of resgen2 to configure.ac - - fixed .resource -> .resources typo - - added a rule to create .response file containing all sources - - using @.response on $(CSC) command line instead of listing - all source files - * src/Properties/AssemblyInfo.cs - - re-formatted license for an 80-column editor - - added more authors to the AssemblyCopyright attribute - - bumped version to 2.0.3 - * prebuild.xml - - bumped version to 2.0.3 - * scripts/autotools.sh - - if 'mono' is in the path, run Prebuild.exe with it - - using dirname to capture correct path to prebuild.xml &c - -2008-02-06T17:18 C.J. Adams-Collier - * src/Core/Targets/NAntTarget.cs - - re-formatted the license for an 80-column editor - - added myself to the copyright - - added a fix submitted by Gryc Ueusp - * src/Core/Targets/AutotoolsTarget.cs - - updated copyright to include 2008 - * THANKS - - created file, added Gryc Ueusp - -2008-01-01T14:50 C.J. Adams-Collier - * src/data/autotools.xml - - fixed .resx -> .resource compilation - - fixed failing edge case where Project is an unsigned Library - - added $(RESOURCE_SRC) to list of extra dist files - * src/Core/Targets/AutotoolsTarget.cs - - removed embeddedResources from extraDistFiles list - -2007-04-18T07:49 C.J. Adams-Collier - * src/data/prebuild-1.7.xsd - - removed default version from references - -2007-04-06T12:42 C.J. Adams-Collier - * src/data/autotools.xml - - added support for /doc: output when XmlDocFile is not empty - - not printing \t \\n on lines that have no content - - gacutil now installs the root assembly instead of the one under - bin/Debug or whatever - -2007-04-04T22:12 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - - removed debugging Console.WriteLine() - * src/data/autotools.xml - - ensuring that install-sh and missing get distributed - - explicitly stating that the sources, snk, resources and binary - references live under $(srcdir) - - corrected uninstall target - - verified distcheck completes successfully - -2007-04-03T21:56 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - - added a using for System.Diagnostics - - added enum ClrVersion for use with the pkg-config parser - - added class SystemPackage for use with the pkg-config parser - - removed explicit "private" property of members since it is implied - - flushing the stream-writer before it's closed - - removed excess braces around an if statement - ! NormalizeAsmName(), AddAssembly(), GetAssembliesWithLibInfo(), - GetAssembliesWithoutLibInfo(), ProcessPiece(), - GetVariableFromPkgConfig(), ParsePCFile(), - RegisterSystemAssemblies(), RunInitialization() - - pulled the above from MonoDevelop to parse the system pkgconfig - files and determine /pkg: arguments. Original sources are here: - http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/SystemAssemblyService.cs - http://svn.myrealbox.com/source/trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/ClrVersion.cs - ! WriteProject() - - now gathering project version from AssemblyInfo.cs if it is part - of the project - - changed the declaration of the ArrayList's in the method - - now copying assembly .config files to the project, distributing, - installing - - making sure all needed files live under the Project directory - - copying strongname keys to project directory - - parsing AssemblyInfo.cs to determine assembly version - - removing all references to ".." - - removed superfluous if(project.References.Count > 0) around - for(int refNum = 0; refNum < project.References.Count; refNum++) - - removed use of runtimeLibs - - adding hook to copy sibling project's generated assemblies to - this project during Make time - - added extra dist target to ensure all files required to build - get distributed during "make dist" - - added new xslt processing args: - -- assemblyName - -- extraDistFiles - -- pkgLibs (/pkg:foo) - -- localCopyTargets (to copy sibling assemblies at Make time) - -- projectVersion (if determined from AssemblyInfo.cs) - -- hasAssemblyConfig (if there's a assembly.exe.config present) - ! Write() - - calling RunInitialization() to gather pkg-config data - * src/data/autotools.xml - - accepting new args passed from AutotoolsTarget.cs - - modernized configure.ac a bit - - using a version of tar that allows >99-char filenames - - added ASSEMBLY_NAME variable - - using assembly name rather than project name for gac installation - - generated assembly is now assembly name and not project name - - accepting /pkg: flags gathered from AutotoolsTarget.cs - - adding Makefile targets to copy sibling project assemblies to . - - fixed Debug, Release targets - - adding support for strongname key signing - - adding /unsafe support - - adding a clean make target - - only running gacutil /u if the assembly being uninstalled is in gac - - added some templates to determine each Configuration's .snk - - added explanation as to why .exe assemblies live in $prefix/lib - * src/Properties/AssemblyInfo.cs - - bumped assembly version - * prebuild.xml - - bumped assembly version - -2007-03-29T18:03 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - ! WriteProject() - - re-named incorrectly-named variable gacLibs to systemLibs - - added another reference list, runtimeLibs which contains the - libs we will need at runtime. we use this to build a MONO_PATH - - added monoPath to the xslt args list - * src/data/autotools.xml - ! - - renamed gacLibs to systemLibs - - added the sources to the dist list - - added logic to install libs that aren't strongnamed - ! - - accepting a param to update the MONO_PATH - -2007-03-28T19:46 C.J. Adams-Collier - * src/Core/Targets/MonoDevelopTarget.cs - ! CleanProject() - - using Assembly.LoadWithPartialName to locate the assembly - * src/Core/Targets/AutotoolsTarget.cs - ! WriteCombine() - - no longer using $PWD to determine a project's source dir; this - doesn't work with elements - - passing the solution name to all templates - fixes - multi-solution prebuild systems - ! WriteProject() - - no longer using $PWD to determine a project's source dir; this - doesn't work with elements - - passing the solution name to all templates - fixes - multi-solution prebuild systems - - copying strongname key to the autotools directory - - using Assembly.LoadWithPartialName to locate assemblies - * src/data/autotools.xml - ! - - fixed the .pc AC_CONFIG_FILES macro - ! - - added solution name param - - wrapping if type=exe check around script install macro - - added type=lib check and .pc file install macro - - added support for Configuration-specific builds (Debug, Release, etc) - - added strongname keyfile code - - TODO: support non-strongnamed library installation - ! - - added space preservation attribute to stylesheet element - - added a lower-case project name variable - - added solution name param - - made for-each template more specific - ! - - added solution name param - ! - - added solution name param - ! - - added solution name param - ! - - added solution name param - -2007-03-27T09:33 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - - now processing the wrapper script if type is "Exe" or "WinExe" - * src/data/autotools.xml - ! - - being more exact about where text escaping is used - - using the correct variable name for the GACUTIL_FLAGS template - - using correct test="" for the AC_CONFIG_FILES macros - ! - - uncommented the bin_SCRIPTS section now that the script is being - generated correctly - ! - - fixed whitespace at beginning of file, before #! - - using lower-case packageName to indicate installation location - -2007-03-27T09:33 C.J. Adams-Collier - * src/data/autotools.xml - ! - * added a lcProjectName which is $projectName lower-cased - * moved autoconf template specifier near AC_OUTPUT - * AC_OUTPUT with args is deprecated. now using AC_CONFIG_FILES - * placed AC_CONFIG_FILES() calls for wrapper script or pkg-config - file in xslt project type checks - ! - * commented out bin_SCRIPTS - * added a lcProjectName which is $projectName lower-cased - * using $lcProjectName instead of the longer version - -2007-03-27T08:39 C.J. Adams-Collier - * src/data/autotools.xml - ! - - added whitespace-preservation - - added the missing projectName param - - replaced bin_SCRIPTS with something that worked - -2007-03-27T07:56 C.J. Adams-Collier - * src/data/autotools.xml - ! - - cleaned up duplicate checks - - placed initialization macros above system check macros - - added some more messages about what's going on - - added GACUTIL_FLAGS variable including /package option - ! - - added an incomplete bin_SCRIPTS - - RCS check says "building" instead of "compiling" - ! - - removed macros that are useful only for projects - ! - - created this element on this revision - - this is a wrapper shell script that lives in the $PATH and runs - the CIL assembly - -2007-03-26T20:18 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - - creating new template arguments to contain the list of libs to - reference: source, binary & GAC - - source libs are included as part of this solution (untested) - - binary libs are distributed with the source (untested) - - GAC libs are assumed to be in the GAC or other lib path (tested) - * src/data/autotools.xml - - created new params through which to accept reference info - - created a working $(CSC) line - - added a TODO item for ordering project dependency for - AC_CONFIG_SUBDIRS code - -2007-03-26T08:41 C.J. Adams-Collier - * src/Core/Targets/AutotoolsTarget.cs - - now creating list of source files in managed code and passing - them to the template via s - * src/data/prebuild-1.7.xsd - - updated the header comment to 2007 - * src/data/autotools.xml - ! - - copied checks from Solution-level configure.ac - - copied solution-level config status - ! - - added elements for file list to be passed through - - made a temporary target for the assembly we're building - - added this target to the deps of "all:" - ! - - changed status header/footer from "- - -" to "===" - -2007-03-23T08:33 C.J. Adams-Collier - Added version attribute handling code for Property element - Added description element handling code - * prebuild.xml - - added /Prebuild/Solution/Property/@version attribute - - added /Prebuild/Solution/Property/Description element - * src/Core/Nodes/ProjectNode.cs - - added some docs where they were missing and obvious - - added code to handle @version - * src/Core/Nodes/DescriptionNode.cs - - new file. Used to handle /Prebuild/Solution/Property/Description - * src/Core/Targets/AutotoolsTarget.cs - - added mkdirDashP(), a recursive directory creation method - - WriteProject() now copies the files to autotools/ - * src/data/prebuild-1.7.xsd - - added /Prebuild/Solution/Property/Description element - - added /Prebuild/Solution/Property/@version attribute - * src/data/autotools.xml - - removed excess - - explicitly using dnpb: prefix - -2007-03-23T04:31 C.J. Adams-Collier - Merged code from my stripped-down test - Adding support for the /Prebuild/Solution/Project/Author element - * prebuild.xml - - added Author elements - - cleaned up the really long Project element - * src/Core/Nodes/ProjectNode.cs - - added Author tag processing code - * src/Core/Nodes/AuthorNode.cs - - Created to process Author elements - - based off of ReferencePathNode.cs - * src/Core/Targets/AutotoolsTarget.cs - - merged code from https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/test.cs - - renamed old WriteCombine to WriteCombineOld - - renamed old WriteProject to WriteProjectOld - * src/data/prebuild-1.7.xsd - - added Author element to Project - * src/data/autotools.xml - - lower-cased utf - - -2007-03-22T13:58 C.J. Adams-Collier - Exposing an XmlDocument that represents the prebuild.xml file - passed to the program - - * src/Core/Kernel.cs - - created an object member called XmlDocument m_CurrentDoc - - created a property to access its value - - using m_CurrentDoc to load up the prebuild.xml file rather than - a local variable called "doc" - -2007-03-22 C.J. Adams-Collier - * prebuild.xml - - added autotools.xml created at https://svn.colliertech.org/mono/dnpbAutotools/dnpbAutotools/autotools.xml - * src/data/autotools.xml - - the same - * src/Core/Targets/MonoDevelopTarget.cs - - fixed bug introduced in r206 - -2007-03-07 C.J. Adams-Collier - * src/data/prebuild-1.7.xsd - - added version attribute to Solution and Project elements - -2006-11-04T00:38 C.J. Adams-Collier - * placing AssemblyInfo.cs into Properties/ - * Fixed double-mention of the package name - -2006-11-03T15:23 C.J. Adams-Collier - * corrected a problem in the Include.am generation code - * created the new .exe - * copied it to the root of the build - -2006-11-03T14:57 C.J. Adams-Collier - * Updated the .exe file - -2006-11-03 C.J. Adams-Collier - * Added a TODO file - * Added a ChangeLog file - * applied some fixes for autotools gac and pkg-config installation - problems diff --git a/Programs/Prebuild/Prebuild.exe b/Programs/Prebuild/Prebuild.exe deleted file mode 100755 index c50d8102..00000000 Binary files a/Programs/Prebuild/Prebuild.exe and /dev/null differ diff --git a/Programs/Prebuild/prebuild.xml b/Programs/Prebuild/prebuild.xml deleted file mode 100644 index 8538e694..00000000 --- a/Programs/Prebuild/prebuild.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - DEBUG;TRACE - false - bin/Debug - true - 1595 - - - - - TRACE - bin/Release - true - false - 1595 - - - - prebuild.xml - prebuild - - - Matthew Holmes (matthew@wildfiregames.com) - Dan Moorehead (dan05a@gmail.com) - Dave Hudson (jendave@yahoo.com) - Rob Loach (http://robloach.net) - C.J. Adams-Collier (cjac@colliertech.org) - The Prebuild project generator - - - DEBUG;TRACE - false - bin/Debug - true - Prebuild.snk - 1595 - - - - - TRACE - bin/Release - true - false - Prebuild.snk - 1595 - - - - - - - - - - - - - - diff --git a/Programs/Prebuild/src/App.ico b/Programs/Prebuild/src/App.ico deleted file mode 100644 index ac4ea6f3..00000000 Binary files a/Programs/Prebuild/src/App.ico and /dev/null differ diff --git a/Programs/Prebuild/src/Core/Attributes/DataNodeAttribute.cs b/Programs/Prebuild/src/Core/Attributes/DataNodeAttribute.cs deleted file mode 100644 index de26e1d4..00000000 --- a/Programs/Prebuild/src/Core/Attributes/DataNodeAttribute.cs +++ /dev/null @@ -1,81 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: sontek $ - * $Date: 2008-04-29 15:51:17 -0700 (Tue, 29 Apr 2008) $ - * $Revision: 264 $ - */ -#endregion - -using System; -using System.Collections.Specialized; - -namespace Prebuild.Core.Attributes -{ - /// - /// - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple=true)] - public sealed class DataNodeAttribute : Attribute - { - #region Fields - - private string m_Name = "unknown"; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// The name. - public DataNodeAttribute(string name) - { - m_Name = name; - } - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs b/Programs/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs deleted file mode 100644 index 55dc769f..00000000 --- a/Programs/Prebuild/src/Core/Attributes/OptionNodeAttribute.cs +++ /dev/null @@ -1,80 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; - -namespace Prebuild.Core.Attributes -{ - /// - /// - /// - [AttributeUsage(AttributeTargets.Field)] - public sealed class OptionNodeAttribute : Attribute - { - #region Fields - - private string m_NodeName; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// Name of the node. - public OptionNodeAttribute(string nodeName) - { - m_NodeName = nodeName; - } - - #endregion - - #region Properties - - /// - /// Gets the name of the node. - /// - /// The name of the node. - public string NodeName - { - get - { - return m_NodeName; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Attributes/TargetAttribute.cs b/Programs/Prebuild/src/Core/Attributes/TargetAttribute.cs deleted file mode 100644 index 50877676..00000000 --- a/Programs/Prebuild/src/Core/Attributes/TargetAttribute.cs +++ /dev/null @@ -1,80 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; - -namespace Prebuild.Core.Attributes -{ - /// - /// - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct)] - public sealed class TargetAttribute : Attribute - { - #region Fields - - private string m_Name; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// The name. - public TargetAttribute(string name) - { - m_Name = name; - } - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/FatalException.cs b/Programs/Prebuild/src/Core/FatalException.cs deleted file mode 100644 index 61467ad9..00000000 --- a/Programs/Prebuild/src/Core/FatalException.cs +++ /dev/null @@ -1,94 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; -using System.Runtime.Serialization; - -namespace Prebuild.Core -{ - /// - /// - /// - [Serializable()] - public class FatalException : Exception - { - #region Constructors - - - /// - /// Initializes a new instance of the class. - /// - public FatalException() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The format. - /// The args. - public FatalException(string format, params object[] args) - : base(String.Format(format, args)) - { - } - - /// - /// Exception with specified string - /// - /// Exception message - public FatalException(string message): base(message) - { - } - - /// - /// - /// - /// - /// - public FatalException(string message, Exception exception) : base(message, exception) - { - } - - /// - /// - /// - /// - /// - protected FatalException(SerializationInfo info, StreamingContext context) : base( info, context ) - { - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Interfaces/IDataNode.cs b/Programs/Prebuild/src/Core/Interfaces/IDataNode.cs deleted file mode 100644 index e885a3b6..00000000 --- a/Programs/Prebuild/src/Core/Interfaces/IDataNode.cs +++ /dev/null @@ -1,56 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; -using System.Xml; - -namespace Prebuild.Core.Interfaces -{ - /// - /// - /// - public interface IDataNode - { - /// - /// Gets or sets the parent. - /// - /// The parent. - IDataNode Parent { get; set; } - /// - /// Parses the specified node. - /// - /// The node. - void Parse(XmlNode node); - } -} diff --git a/Programs/Prebuild/src/Core/Interfaces/ITarget.cs b/Programs/Prebuild/src/Core/Interfaces/ITarget.cs deleted file mode 100644 index 2baf72b6..00000000 --- a/Programs/Prebuild/src/Core/Interfaces/ITarget.cs +++ /dev/null @@ -1,60 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; - -namespace Prebuild.Core.Interfaces -{ - /// - /// - /// - public interface ITarget - { - /// - /// Writes the specified kern. - /// - /// The kern. - void Write(Kernel kern); - /// - /// Cleans the specified kern. - /// - /// The kern. - void Clean(Kernel kern); - /// - /// Gets the name. - /// - /// The name. - string Name { get; } - } -} \ No newline at end of file diff --git a/Programs/Prebuild/src/Core/Kernel.cs b/Programs/Prebuild/src/Core/Kernel.cs deleted file mode 100644 index f87c53bb..00000000 --- a/Programs/Prebuild/src/Core/Kernel.cs +++ /dev/null @@ -1,844 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -Rob Loach (http://www.robloach.net), -C.J. Adams-Collier (cjac@colliertech.org) - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: dmoonfire $ - * $Date: 2008-12-09 18:04:22 -0800 (Tue, 09 Dec 2008) $ - * $Revision: 279 $ - */ -#endregion - -using System; -using System.Diagnostics; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Xml; -using System.Xml.Schema; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Parse; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core -{ - /// - /// - /// - public class Kernel : IDisposable - { - #region Inner Classes - - private struct NodeEntry - { - public Type Type; - public DataNodeAttribute Attribute; - } - - #endregion - - #region Fields - - private static Kernel m_Instance = new Kernel(); - - /// - /// This must match the version of the schema that is embeeded - /// - private static string m_SchemaVersion = "1.7"; - private static string m_Schema = "prebuild-" + m_SchemaVersion + ".xsd"; - private static string m_SchemaURI = "http://dnpb.sourceforge.net/schemas/" + m_Schema; - bool disposed; - private Version m_Version; - private string m_Revision = ""; - private CommandLineCollection m_CommandLine; - private Log m_Log; - private CurrentDirectory m_CurrentWorkingDirectory; - private XmlSchemaCollection m_Schemas; - - private Hashtable m_Targets; - private Hashtable m_Nodes; - - ArrayList m_Solutions; - string m_Target; - string m_Clean; - string[] m_RemoveDirectories; - string m_CurrentFile; - XmlDocument m_CurrentDoc; - bool m_PauseAfterFinish; - string[] m_ProjectGroups; - StringCollection m_Refs; - - - #endregion - - #region Constructors - - private Kernel() - { - } - - #endregion - - #region Properties - - /// - /// Gets a value indicating whether [pause after finish]. - /// - /// true if [pause after finish]; otherwise, false. - public bool PauseAfterFinish - { - get - { - return m_PauseAfterFinish; - } - } - - /// - /// Gets the instance. - /// - /// The instance. - public static Kernel Instance - { - get - { - return m_Instance; - } - } - - /// - /// Gets the version. - /// - /// The version. - public string Version - { - get - { - return String.Format("{0}.{1}.{2}{3}", m_Version.Major, m_Version.Minor, m_Version.Build, m_Revision); - } - } - - /// - /// Gets the command line. - /// - /// The command line. - public CommandLineCollection CommandLine - { - get - { - return m_CommandLine; - } - } - - /// - /// Gets the targets. - /// - /// The targets. - public Hashtable Targets - { - get - { - return m_Targets; - } - } - - /// - /// Gets the log. - /// - /// The log. - public Log Log - { - get - { - return m_Log; - } - } - - /// - /// Gets the current working directory. - /// - /// The current working directory. - public CurrentDirectory CurrentWorkingDirectory - { - get - { - return m_CurrentWorkingDirectory; - } - } - - /// - /// Gets the solutions. - /// - /// The solutions. - public ArrayList Solutions - { - get - { - return m_Solutions; - } - } - - /// - /// Gets the XmlDocument object representing the prebuild.xml - /// being processed - /// - /// The XmlDocument object - public XmlDocument CurrentDoc - { - get - { - return m_CurrentDoc; - } - } - - #endregion - - #region Private Methods - - private void RemoveDirectories(string rootDir, string[] dirNames) - { - foreach(string dir in Directory.GetDirectories(rootDir)) - { - string simpleName = Path.GetFileName(dir); - - if(Array.IndexOf(dirNames, simpleName) != -1) - { - //delete if the name matches one of the directory names to delete - string fullDirPath = Path.GetFullPath(dir); - Directory.Delete(fullDirPath,true); - } - else//not a match, so check children - { - RemoveDirectories(dir,dirNames); - //recurse, checking children for them - } - } - } - -// private void RemoveDirectoryMatches(string rootDir, string dirPattern) -// { -// foreach(string dir in Directory.GetDirectories(rootDir)) -// { -// foreach(string match in Directory.GetDirectories(dir)) -// {//delete all child directories that match -// Directory.Delete(Path.GetFullPath(match),true); -// } -// //recure through the rest checking for nested matches to delete -// RemoveDirectoryMatches(dir,dirPattern); -// } -// } - - private void LoadSchema() - { - Assembly assembly = this.GetType().Assembly; - Stream stream = assembly.GetManifestResourceStream("Prebuild.data." + m_Schema); - if(stream == null) - { - //try without the default namespace prepending to it in case was compiled with SharpDevelop or MonoDevelop instead of Visual Studio .NET - stream = assembly.GetManifestResourceStream(m_Schema); - if(stream == null) - { - throw new System.Reflection.TargetException(string.Format("Could not find the scheme embedded resource file '{0}'.", m_Schema)); - } - } - XmlReader schema = new XmlTextReader(stream); - - m_Schemas = new XmlSchemaCollection(); - m_Schemas.Add(m_SchemaURI, schema); - } - - private void CacheVersion() - { - m_Version = Assembly.GetEntryAssembly().GetName().Version; - } - - private void CacheTargets(Assembly assm) - { - foreach(Type t in assm.GetTypes()) - { - TargetAttribute ta = (TargetAttribute)Helper.CheckType(t, typeof(TargetAttribute), typeof(ITarget)); - - if(ta == null) - continue; - - if (t.IsAbstract) - continue; - - ITarget target = (ITarget)assm.CreateInstance(t.FullName); - if (target == null) - { - throw new MissingMethodException("Could not create ITarget instance"); - } - - m_Targets[ta.Name] = target; - } - } - - private void CacheNodeTypes(Assembly assm) - { - foreach(Type t in assm.GetTypes()) - { - foreach (DataNodeAttribute dna in t.GetCustomAttributes(typeof(DataNodeAttribute), true)) - { - NodeEntry ne = new NodeEntry(); - ne.Type = t; - ne.Attribute = dna; - m_Nodes[dna.Name] = ne; - } - } - } - - private void LogBanner() - { - m_Log.Write("Prebuild v" + this.Version); - m_Log.Write("Copyright (c) 2004-2008"); - m_Log.Write("Matthew Holmes (matthew@wildfiregames.com),"); - m_Log.Write("Dan Moorehead (dan05a@gmail.com),"); - m_Log.Write("David Hudson (jendave@yahoo.com),"); - m_Log.Write("Rob Loach (http://www.robloach.net),"); - m_Log.Write("C.J. Adams-Collier (cjac@colliertech.org),"); - - m_Log.Write("See 'prebuild /usage' for help"); - m_Log.Write(); - } - - - - private void ProcessFile(string file) - { - ProcessFile(file, this.m_Solutions); - } - - public void ProcessFile(ProcessNode node, SolutionNode parent) - { - if (node.IsValid) - { - ArrayList list = new ArrayList(); - ProcessFile(node.Path, list); - - foreach (SolutionNode solution in list) - parent.SolutionsTable[solution.Name] = solution; - } - } - - /// - /// - /// - /// - /// - public void ProcessFile(string file, IList solutions) - { - m_CurrentWorkingDirectory.Push(); - - string path = file; - try - { - try - { - path = Helper.ResolvePath(path); - } - catch(ArgumentException) - { - m_Log.Write("Could not open Prebuild file: " + path); - m_CurrentWorkingDirectory.Pop(); - return; - } - - m_CurrentFile = path; - Helper.SetCurrentDir(Path.GetDirectoryName(path)); - - XmlTextReader reader = new XmlTextReader(path); - - Core.Parse.Preprocessor pre = new Core.Parse.Preprocessor(); - - //register command line arguments as XML variables - IDictionaryEnumerator dict = m_CommandLine.GetEnumerator(); - while (dict.MoveNext()) - { - string name = dict.Key.ToString().Trim(); - if (name.Length > 0) - pre.RegisterVariable(name, dict.Value.ToString()); - } - - string xml = pre.Process(reader);//remove script and evaulate pre-proccessing to get schema-conforming XML - - // See if the user put into a pseudo target of "prebuild:preprocessed-input" to indicate they want to see the - // output before the system processes it. - if (m_CommandLine.WasPassed("ppi")) - { - // Get the filename if there is one, otherwise use a default. - string ppiFile = m_CommandLine["ppi"]; - if (ppiFile == null || ppiFile.Trim().Length == 0) - { - ppiFile = "preprocessed-input.xml"; - } - - // Write out the string to the given stream. - try - { - using (StreamWriter ppiWriter = new StreamWriter(ppiFile)) - { - ppiWriter.WriteLine(xml); - } - } - catch(IOException ex) - { - Console.WriteLine("Could not write PPI file '{0}': {1}", ppiFile, ex.Message); - } - - // Finish processing this special tag. - return; - } - - m_CurrentDoc = new XmlDocument(); - try - { - XmlValidatingReader validator = new XmlValidatingReader(new XmlTextReader(new StringReader(xml))); - - //validate while reading from string into XmlDocument DOM structure in memory - foreach(XmlSchema schema in m_Schemas) - { - validator.Schemas.Add(schema); - } - m_CurrentDoc.Load(validator); - } - catch(XmlException e) - { - throw new XmlException(e.ToString()); - } - - //is there a purpose to writing it? An syntax/schema problem would have been found during pre.Process() and reported with details - if(m_CommandLine.WasPassed("ppo")) - { - string ppoFile = m_CommandLine["ppo"]; - if(ppoFile == null || ppoFile.Trim().Length < 1) - { - ppoFile = "preprocessed.xml"; - } - - StreamWriter writer = null; - try - { - writer = new StreamWriter(ppoFile); - writer.Write(xml); - } - catch(IOException ex) - { - Console.WriteLine("Could not write PPO file '{0}': {1}", ppoFile, ex.Message); - } - finally - { - if(writer != null) - { - writer.Close(); - } - } - return; - } - //start reading the xml config file - XmlElement rootNode = m_CurrentDoc.DocumentElement; - //string suggestedVersion = Helper.AttributeValue(rootNode,"version","1.0"); - Helper.CheckForOSVariables = Helper.ParseBoolean(rootNode,"checkOsVars",false); - - foreach(XmlNode node in rootNode.ChildNodes)//solutions or if pre-proc instructions - { - IDataNode dataNode = ParseNode(node, null); - if(dataNode is ProcessNode) - { - ProcessNode proc = (ProcessNode)dataNode; - if(proc.IsValid) - { - ProcessFile(proc.Path); - } - } - else if(dataNode is SolutionNode) - { - solutions.Add(dataNode); - } - } - } - catch(XmlSchemaException xse) - { - m_Log.Write("XML validation error at line {0} in {1}:\n\n{2}", - xse.LineNumber, path, xse.Message); - } - finally - { - m_CurrentWorkingDirectory.Pop(); - } - } - - #endregion - - #region Public Methods - - /// - /// Allows the project. - /// - /// The project groups flags. - /// - public bool AllowProject(string projectGroupsFlags) - { - if(m_ProjectGroups != null && m_ProjectGroups.Length > 0) - { - if(projectGroupsFlags != null && projectGroupsFlags.Length == 0) - { - foreach(string group in projectGroupsFlags.Split('|')) - { - if(Array.IndexOf(m_ProjectGroups, group) != -1) //if included in the filter list - { - return true; - } - } - } - return false;//not included in the list or no groups specified for the project - } - return true;//no filter specified in the command line args - } - - /// - /// Gets the type of the node. - /// - /// The node. - /// - public Type GetNodeType(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - if(!m_Nodes.ContainsKey(node.Name)) - { - return null; - } - - NodeEntry ne = (NodeEntry)m_Nodes[node.Name]; - return ne.Type; - } - - /// - /// - /// - /// - /// - /// - public IDataNode ParseNode(XmlNode node, IDataNode parent) - { - return ParseNode(node, parent, null); - } - - //Create an instance of the data node type that is mapped to the name of the xml DOM node - /// - /// Parses the node. - /// - /// The node. - /// The parent. - /// The pre node. - /// - public IDataNode ParseNode(XmlNode node, IDataNode parent, IDataNode preNode) - { - IDataNode dataNode = null; - - try - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - if(preNode == null) - { - if(!m_Nodes.ContainsKey(node.Name)) - { - //throw new XmlException("Unknown XML node: " + node.Name); - return null; - } - - NodeEntry ne = (NodeEntry)m_Nodes[node.Name]; - Type type = ne.Type; - //DataNodeAttribute dna = ne.Attribute; - - dataNode = (IDataNode)type.Assembly.CreateInstance(type.FullName); - if(dataNode == null) - { - throw new System.Reflection.TargetException("Could not create new parser instance: " + type.FullName); - } - } - else - dataNode = preNode; - - dataNode.Parent = parent; - dataNode.Parse(node); - } - catch(WarningException wex) - { - m_Log.Write(LogType.Warning, wex.Message); - return null; - } - catch(FatalException fex) - { - m_Log.WriteException(LogType.Error, fex); - throw; - } - catch(Exception ex) - { - m_Log.WriteException(LogType.Error, ex); - throw; - } - - return dataNode; - } - - /// - /// Initializes the specified target. - /// - /// The target. - /// The args. - public void Initialize(LogTargets target, string[] args) - { - m_Targets = new Hashtable(); - CacheTargets(this.GetType().Assembly); - m_Nodes = new Hashtable(); - CacheNodeTypes(this.GetType().Assembly); - CacheVersion(); - - m_CommandLine = new CommandLineCollection(args); - - string logFile = null; - if(m_CommandLine.WasPassed("log")) - { - logFile = m_CommandLine["log"]; - - if(logFile != null && logFile.Length == 0) - { - logFile = "Prebuild.log"; - } - } - else - { - target = target & ~LogTargets.File; //dont output to a file - } - - m_Log = new Log(target, logFile); - LogBanner(); - - m_CurrentWorkingDirectory = new CurrentDirectory(); - - m_Target = m_CommandLine["target"]; - m_Clean = m_CommandLine["clean"]; - string removeDirs = m_CommandLine["removedir"]; - if(removeDirs != null && removeDirs.Length == 0) - { - m_RemoveDirectories = removeDirs.Split('|'); - } - - string flags = m_CommandLine["allowedgroups"];//allows filtering by specifying a pipe-delimited list of groups to include - if(flags != null && flags.Length == 0) - { - m_ProjectGroups = flags.Split('|'); - } - m_PauseAfterFinish = m_CommandLine.WasPassed("pause"); - - LoadSchema(); - - m_Solutions = new ArrayList(); - m_Refs = new StringCollection(); - } - - /// - /// Processes this instance. - /// - public void Process() - { - bool perfomedOtherTask = false; - if(m_RemoveDirectories != null && m_RemoveDirectories.Length > 0) - { - try - { - RemoveDirectories(".",m_RemoveDirectories); - } - catch(IOException e) - { - m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories); - m_Log.WriteException(LogType.Error,e); - } - catch(UnauthorizedAccessException e) - { - m_Log.Write("Failed to remove directories named {0}",m_RemoveDirectories); - m_Log.WriteException(LogType.Error,e); - } - perfomedOtherTask = true; - } - - if(m_Target != null && m_Clean != null) - { - m_Log.Write(LogType.Error, "The options /target and /clean cannot be passed together"); - return; - } - else if(m_Target == null && m_Clean == null) - { - if(perfomedOtherTask) //finished - { - return; - } - m_Log.Write(LogType.Error, "Must pass either /target or /clean to process a Prebuild file"); - return; - } - - string file = "./prebuild.xml"; - if(m_CommandLine.WasPassed("file")) - { - file = m_CommandLine["file"]; - } - - ProcessFile(file); - - string target = (m_Target != null ? m_Target.ToLower() : m_Clean.ToLower()); - bool clean = (m_Target == null); - if(clean && target != null && target.Length == 0) - { - target = "all"; - } - if(clean && target == "all")//default to all if no target was specified for clean - { - //check if they passed yes - if (!m_CommandLine.WasPassed("yes")) - { - Console.WriteLine("WARNING: This operation will clean ALL project files for all targets, are you sure? (y/n):"); - string ret = Console.ReadLine(); - if(ret == null) - { - return; - } - ret = ret.Trim().ToLower(); - if((ret.ToLower() != "y" && ret.ToLower() != "yes")) - { - return; - } - } - //clean all targets (just cleaning vs2002 target didn't clean nant) - foreach(ITarget targ in m_Targets.Values) - { - targ.Clean(this); - } - } - else - { - if (!m_Targets.Contains(target)) { - m_Log.Write(LogType.Error, "Unknown Target \"{0}\"", target); - return; - } - ITarget targ = (ITarget)m_Targets[target]; - - if(clean) - { - targ.Clean(this); - } - else - { - targ.Write(this); - } - } - - m_Log.Flush(); - } - - #endregion - - #region IDisposable Members - - /// - /// - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Dispose objects - /// - /// - /// If true, it will dispose close the handle - /// - /// - /// Will dispose managed and unmanaged resources. - /// - protected virtual void Dispose(bool disposing) - { - if (!this.disposed) - { - if (disposing) - { - if (this.m_Log != null) - { - this.m_Log.Close(); - this.m_Log = null; - } - } - } - this.disposed = true; - } - - /// - /// - /// - ~Kernel() - { - this.Dispose(false); - } - - /// - /// Closes and destroys this object - /// - /// - /// Same as Dispose(true) - /// - public void Close() - { - Dispose(); - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/AuthorNode.cs b/Programs/Prebuild/src/Core/Nodes/AuthorNode.cs deleted file mode 100644 index 03ea9348..00000000 --- a/Programs/Prebuild/src/Core/Nodes/AuthorNode.cs +++ /dev/null @@ -1,98 +0,0 @@ -#region BSD License -/* -Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source $ - * $Author: $ - * $Date: $ - * $Revision: $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Author")] - public class AuthorNode : DataNode - { - #region Fields - - private string m_Signature; - - #endregion - - #region Properties - - /// - /// Gets the signature. - /// - /// The signature. - public string Signature - { - get - { - return m_Signature; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Signature = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Signature == null) - { - m_Signature = ""; - } - - m_Signature = m_Signature.Trim(); - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/ConfigurationNode.cs b/Programs/Prebuild/src/Core/Nodes/ConfigurationNode.cs deleted file mode 100644 index a160f002..00000000 --- a/Programs/Prebuild/src/Core/Nodes/ConfigurationNode.cs +++ /dev/null @@ -1,177 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Configuration")] - public class ConfigurationNode : DataNode, ICloneable - { - #region Fields - - private string m_Name = "unknown"; - private OptionsNode m_Options; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public ConfigurationNode() - { - m_Options = new OptionsNode(); - } - - #endregion - - #region Properties - - /// - /// Gets or sets the parent. - /// - /// The parent. - public override IDataNode Parent - { - get - { - return base.Parent; - } - set - { - base.Parent = value; - if(base.Parent is SolutionNode) - { - SolutionNode node = (SolutionNode)base.Parent; - if(node != null && node.Options != null) - { - node.Options.CopyTo(m_Options); - } - } - } - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - /// - /// Gets or sets the options. - /// - /// The options. - public OptionsNode Options - { - get - { - return m_Options; - } - set - { - m_Options = value; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Name = Helper.AttributeValue(node, "name", m_Name); - if( node == null ) - { - throw new ArgumentNullException("node"); - } - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is OptionsNode) - { - ((OptionsNode)dataNode).CopyTo(m_Options); - } - } - } - - /// - /// Copies to. - /// - /// The conf. - public void CopyTo(ConfigurationNode conf) - { - m_Options.CopyTo(conf.m_Options); - } - - #endregion - - #region ICloneable Members - - /// - /// Creates a new object that is a copy of the current instance. - /// - /// - /// A new object that is a copy of this instance. - /// - public object Clone() - { - ConfigurationNode ret = new ConfigurationNode(); - ret.m_Name = m_Name; - m_Options.CopyTo(ret.m_Options); - return ret; - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/DataNode.cs b/Programs/Prebuild/src/Core/Nodes/DataNode.cs deleted file mode 100644 index 46422673..00000000 --- a/Programs/Prebuild/src/Core/Nodes/DataNode.cs +++ /dev/null @@ -1,126 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: sontek $ - * $Date: 2008-05-07 13:59:35 -0700 (Wed, 07 May 2008) $ - * $Revision: 270 $ - */ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using System.IO; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - public class DataNode : IDataNode - { - #region Fields - - private IDataNode parent; - string[] m_WebTypes = new string[] { "aspx", "ascx", "master", "ashx", "asmx" }; - - #endregion - - #region IDataNode Members - - /// - /// Gets or sets the parent. - /// - /// The parent. - public virtual IDataNode Parent - { - get - { - return parent; - } - set - { - parent = value; - } - } - public string[] WebTypes - { - get { return m_WebTypes; } - } - /// - /// Parses the specified node. - /// - /// The node. - public virtual void Parse(XmlNode node) - { - } - public BuildAction GetBuildActionByFileName(string fileName) - { - string extension = Path.GetExtension(fileName).ToLower(); - foreach (string type in WebTypes) - { - if (extension == type) - return BuildAction.Content; - } - return BuildAction.Compile; - } - /// - /// Parses the file type to figure out what type it is - /// - /// - public SubType GetSubTypeByFileName(string fileName) - { - string extension = System.IO.Path.GetExtension(fileName).ToLower(); - string designer = String.Format(".designer{0}", extension); - string path = fileName.ToLower(); - if (extension == ".resx") - { - return SubType.Designer; - } - else if (path.EndsWith(".settings")) - { - return SubType.Settings; - } - else - { - - foreach (string type in WebTypes) - { - if (path.EndsWith(string.Format("{0}{1}", type, extension))) - { - return SubType.CodeBehind; - } - } - } - return SubType.Code; - } - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs b/Programs/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs deleted file mode 100644 index dc709b91..00000000 --- a/Programs/Prebuild/src/Core/Nodes/DatabaseProjectNode.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; -using System.Collections; -using System.Text; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - [DataNode("DatabaseProject")] - public class DatabaseProjectNode : DataNode - { - string name; - string path; - string fullpath; - Guid guid = Guid.NewGuid(); - ArrayList authors = new ArrayList(); - ArrayList references = new ArrayList(); - - public Guid Guid - { - get { return this.guid; } - } - - public string Name - { - get { return this.name; } - } - - public string Path - { - get { return this.path; } - } - - public string FullPath - { - get { return this.fullpath; } - } - - public IEnumerable References - { - get { return this.references; } - } - - public override void Parse(System.Xml.XmlNode node) - { - this.name = Helper.AttributeValue(node, "name", this.name); - this.path = Helper.AttributeValue(node, "path", this.name); - - try - { - this.fullpath = Helper.ResolvePath(this.path); - } - catch - { - throw new WarningException("Could not resolve Solution path: {0}", this.path); - } - - Kernel.Instance.CurrentWorkingDirectory.Push(); - - try - { - Helper.SetCurrentDir(this.fullpath); - - if (node == null) - { - throw new ArgumentNullException("node"); - } - - foreach (XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - - if (dataNode == null) - continue; - - if (dataNode is AuthorNode) - this.authors.Add(dataNode); - else if (dataNode is DatabaseReferenceNode) - this.references.Add(dataNode); - } - } - finally - { - Kernel.Instance.CurrentWorkingDirectory.Pop(); - } - - base.Parse(node); - } - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs b/Programs/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs deleted file mode 100644 index 8f7fd1c6..00000000 --- a/Programs/Prebuild/src/Core/Nodes/DatabaseReferenceNode.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - [DataNode("DatabaseReference")] - public class DatabaseReferenceNode : DataNode - { - string name; - Guid providerId; - string connectionString; - - public string Name - { - get { return this.name; } - } - - public Guid ProviderId - { - get { return this.providerId; } - } - - public string ConnectionString - { - get { return this.connectionString; } - } - - public override void Parse(System.Xml.XmlNode node) - { - this.name = Helper.AttributeValue(node, "name", this.name); - - string providerName = Helper.AttributeValue(node, "providerName", string.Empty); - if (providerName != null) - { - switch (providerName) - { - // digitaljeebus: pulled from HKLM\SOFTWARE\Microsoft\VisualStudio\9.0\DataProviders\* - // Not sure if these will help other operating systems, or if there's a better way. - case "Microsoft.SqlServerCe.Client.3.5": - this.providerId = new Guid("7C602B5B-ACCB-4acd-9DC0-CA66388C1533"); break; - case "System.Data.OleDb": - this.providerId = new Guid("7F041D59-D76A-44ed-9AA2-FBF6B0548B80"); break; - case "System.Data.OracleClient": - this.providerId = new Guid("8F5C5018-AE09-42cf-B2CC-2CCCC7CFC2BB"); break; - case "System.Data.SqlClient": - this.providerId = new Guid("91510608-8809-4020-8897-FBA057E22D54"); break; - case "System.Data.Odbc": - this.providerId = new Guid("C3D4F4CE-2C48-4381-B4D6-34FA50C51C86"); break; - - default: - throw new ArgumentOutOfRangeException("providerName", providerName, "Could not provider name to an id."); - } - } - else - this.providerId = new Guid(Helper.AttributeValue(node, "providerId", Guid.Empty.ToString("B"))); - - this.connectionString = Helper.AttributeValue(node, "connectionString", this.connectionString); - - base.Parse(node); - } - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/DescriptionNode.cs b/Programs/Prebuild/src/Core/Nodes/DescriptionNode.cs deleted file mode 100644 index cff7afc1..00000000 --- a/Programs/Prebuild/src/Core/Nodes/DescriptionNode.cs +++ /dev/null @@ -1,98 +0,0 @@ -#region BSD License -/* -Copyright (c) 2007 C.J. Adams-Collier (cjac@colliertech.org) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source $ - * $Author: $ - * $Date: $ - * $Revision: $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// The object representing the /Prebuild/Solution/Project/Description element - /// - [DataNode("Description")] - public class DescriptionNode : DataNode - { - #region Fields - - private string m_Value; - - #endregion - - #region Properties - - /// - /// Gets the description Value. - /// - /// The description Value. - public string Value - { - get - { - return m_Value; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Value = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Value == null) - { - m_Value = ""; - } - - m_Value = m_Value.Trim(); - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/ExcludeNode.cs b/Programs/Prebuild/src/Core/Nodes/ExcludeNode.cs deleted file mode 100644 index 16d83931..00000000 --- a/Programs/Prebuild/src/Core/Nodes/ExcludeNode.cs +++ /dev/null @@ -1,98 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: borrillis $ - * $Date: 2007-05-24 09:03:16 -0700 (Thu, 24 May 2007) $ - * $Revision: 243 $ - */ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Exclude")] - public class ExcludeNode : DataNode - { - #region Fields - - private string m_Pattern = ""; - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Pattern; - } - } - - /// - /// Gets the pattern. - /// - /// The pattern. - public string Pattern - { - get - { - return m_Pattern; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Pattern = Helper.AttributeValue( node, "name", m_Pattern ); - m_Pattern = Helper.AttributeValue(node, "pattern", m_Pattern ); - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/FileNode.cs b/Programs/Prebuild/src/Core/Nodes/FileNode.cs deleted file mode 100644 index 92bc08ea..00000000 --- a/Programs/Prebuild/src/Core/Nodes/FileNode.cs +++ /dev/null @@ -1,280 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: sontek $ - * $Date: 2008-05-05 17:03:34 -0700 (Mon, 05 May 2008) $ - * $Revision: 269 $ - */ -#endregion - -using System; -using System.IO; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; -using Prebuild.Core.Targets; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - public enum BuildAction - { - /// - /// - /// - None, - /// - /// - /// - Compile, - /// - /// - /// - Content, - /// - /// - /// - EmbeddedResource - } - - /// - /// - /// - public enum SubType - { - /// - /// - /// - Code, - /// - /// - /// - Component, - /// - /// - /// - Designer, - /// - /// - /// - Form, - /// - /// - /// - Settings, - /// - /// - /// - UserControl, - /// - /// - /// - CodeBehind, - } - - public enum CopyToOutput - { - Never, - Always, - PreserveNewest - } - - /// - /// - /// - [DataNode("File")] - public class FileNode : DataNode - { - #region Fields - - private string m_Path; - private string m_ResourceName = ""; - private BuildAction? m_BuildAction; - private bool m_Valid; - private SubType? m_SubType; - private CopyToOutput m_CopyToOutput = CopyToOutput.Never; - private bool m_Link = false; - private string m_LinkPath = string.Empty; - private bool m_PreservePath = false; - - - #endregion - - #region Properties - - /// - /// - /// - public string Path - { - get - { - return m_Path; - } - } - - /// - /// - /// - public string ResourceName - { - get - { - return m_ResourceName; - } - } - - /// - /// - /// - public BuildAction BuildAction - { - get - { - if (m_BuildAction != null) - return m_BuildAction.Value; - else - return GetBuildActionByFileName(this.Path); - - } - } - - public CopyToOutput CopyToOutput - { - get - { - return this.m_CopyToOutput; - } - } - - public bool IsLink - { - get - { - return this.m_Link; - } - } - - public string LinkPath - { - get - { - return this.m_LinkPath; - } - } - /// - /// - /// - public SubType SubType - { - get - { - if (m_SubType != null) - return m_SubType.Value; - else - return GetSubTypeByFileName(this.Path); - } - } - - /// - /// - /// - public bool IsValid - { - get - { - return m_Valid; - } - } - - /// - /// - /// - /// - /// - public bool PreservePath - { - get - { - return m_PreservePath; - } - } - - #endregion - - #region Public Methods - - /// - /// - /// - /// - public override void Parse(XmlNode node) - { - string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); - if (buildAction != string.Empty) - m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); - string subType = Helper.AttributeValue(node, "subType", string.Empty); - if (subType != String.Empty) - m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); - - m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); - this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); - if ( this.m_Link == true ) - { - this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty ); - } - this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); - this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) ); - - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Path == null) - { - m_Path = ""; - } - - m_Path = m_Path.Trim(); - m_Valid = true; - if(!File.Exists(m_Path)) - { - m_Valid = false; - Kernel.Instance.Log.Write(LogType.Warning, "File does not exist: {0}", m_Path); - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/FilesNode.cs b/Programs/Prebuild/src/Core/Nodes/FilesNode.cs deleted file mode 100644 index 008f5b06..00000000 --- a/Programs/Prebuild/src/Core/Nodes/FilesNode.cs +++ /dev/null @@ -1,261 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: sontek $ - * $Date: 2008-05-05 17:03:34 -0700 (Mon, 05 May 2008) $ - * $Revision: 269 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using System.IO; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Files")] - public class FilesNode : DataNode - { - #region Fields - - private StringCollection m_Files; - private Hashtable m_BuildActions; - private Hashtable m_SubTypes; - private Hashtable m_ResourceNames; - private Hashtable m_CopyToOutputs; - private Hashtable m_Links; - private Hashtable m_LinkPaths; - private Hashtable m_PreservePaths; - - #endregion - - #region Constructors - - /// - /// - /// - public FilesNode() - { - m_Files = new StringCollection(); - m_BuildActions = new Hashtable(); - m_SubTypes = new Hashtable(); - m_ResourceNames = new Hashtable(); - m_CopyToOutputs = new Hashtable(); - m_Links = new Hashtable(); - m_LinkPaths = new Hashtable(); - m_PreservePaths = new Hashtable(); - } - - #endregion - - #region Properties - - /// - /// - /// - public int Count - { - get - { - return m_Files.Count; - } - } - - #endregion - - #region Public Methods - - /// - /// - /// - /// - /// - public BuildAction GetBuildAction(string file) - { - if (file.EndsWith(".settings")) - return BuildAction.None; - else if (file.EndsWith(".ico")) - return BuildAction.Content; - - if(!m_BuildActions.ContainsKey(file)) - { - return BuildAction.Compile; - } - - return (BuildAction)m_BuildActions[file]; - } - - public CopyToOutput GetCopyToOutput(string file) - { - if (!this.m_CopyToOutputs.ContainsKey(file)) - { - return CopyToOutput.Never; - } - return (CopyToOutput) this.m_CopyToOutputs[file]; - } - - public bool GetIsLink(string file) - { - if (!this.m_Links.ContainsKey(file)) - { - return false; - } - return (bool) this.m_Links[file]; - } - - public string GetLinkPath( string file ) - { - if ( !this.m_LinkPaths.ContainsKey( file ) ) - { - return string.Empty; - } - return (string)this.m_LinkPaths[ file ]; - } - - /// - /// - /// - /// - /// - public SubType GetSubType(string file) - { - if(!m_SubTypes.ContainsKey(file)) - { - return SubType.Code; - } - - return (SubType)m_SubTypes[file]; - } - - /// - /// - /// - /// - /// - public string GetResourceName(string file) - { - if(!m_ResourceNames.ContainsKey(file)) - { - return ""; - } - - return (string)m_ResourceNames[file]; - } - - /// - /// - /// - /// - /// - public bool GetPreservePath( string file ) - { - if ( !m_PreservePaths.ContainsKey( file ) ) - { - return false; - } - - return (bool)m_PreservePaths[ file ]; - } - - /// - /// - /// - /// - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is FileNode) - { - FileNode fileNode = (FileNode)dataNode; - if(fileNode.IsValid) - { - if (!m_Files.Contains(fileNode.Path)) - { - m_Files.Add(fileNode.Path); - m_BuildActions[fileNode.Path] = fileNode.BuildAction; - m_SubTypes[fileNode.Path] = fileNode.SubType; - m_ResourceNames[fileNode.Path] = fileNode.ResourceName; - this.m_PreservePaths[ fileNode.Path ] = fileNode.PreservePath; - this.m_Links[ fileNode.Path ] = fileNode.IsLink; - this.m_LinkPaths[ fileNode.Path ] = fileNode.LinkPath; - this.m_CopyToOutputs[ fileNode.Path ] = fileNode.CopyToOutput; - - } - } - } - else if(dataNode is MatchNode) - { - foreach(string file in ((MatchNode)dataNode).Files) - { - MatchNode matchNode = (MatchNode)dataNode; - if (!m_Files.Contains(file)) - { - m_Files.Add(file); - m_BuildActions[ file ] = matchNode.BuildAction == null ? GetBuildActionByFileName(file) : matchNode.BuildAction; - m_SubTypes[file] = matchNode.SubType == null ? GetSubTypeByFileName(file) : matchNode.SubType.Value; - m_ResourceNames[ file ] = matchNode.ResourceName; - this.m_PreservePaths[ file ] = matchNode.PreservePath; - this.m_Links[ file ] = matchNode.IsLink; - this.m_LinkPaths[ file ] = matchNode.LinkPath; - this.m_CopyToOutputs[ file ] = matchNode.CopyToOutput; - - } - } - } - } - } - - // TODO: Check in to why StringCollection's enumerator doesn't implement - // IEnumerator? - /// - /// - /// - /// - public StringEnumerator GetEnumerator() - { - return m_Files.GetEnumerator(); - } - - #endregion - - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/MatchNode.cs b/Programs/Prebuild/src/Core/Nodes/MatchNode.cs deleted file mode 100644 index 3b5ac770..00000000 --- a/Programs/Prebuild/src/Core/Nodes/MatchNode.cs +++ /dev/null @@ -1,351 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: sontek $ - * $Date: 2008-05-07 13:59:35 -0700 (Wed, 07 May 2008) $ - * $Revision: 270 $ - */ -#endregion - -using System; -using System.Collections.Specialized; -using System.IO; -using System.Text.RegularExpressions; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; -using System.Collections; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Match")] - public class MatchNode : DataNode - { - #region Fields - - private StringCollection m_Files; - private Regex m_Regex; - private BuildAction? m_BuildAction; - private SubType? m_SubType; - string m_ResourceName = ""; - private CopyToOutput m_CopyToOutput; - private bool m_Link; - private string m_LinkPath; - private bool m_PreservePath; - private ArrayList m_Exclusions; - - #endregion - - #region Constructors - - /// - /// - /// - public MatchNode() - { - m_Files = new StringCollection(); - m_Exclusions = new ArrayList(); - } - - #endregion - - #region Properties - - /// - /// - /// - public StringCollection Files - { - get - { - return m_Files; - } - } - - /// - /// - /// - public BuildAction? BuildAction - { - get - { - return m_BuildAction; - } - } - - /// - /// - /// - public SubType? SubType - { - get - { - return m_SubType; - } - } - - public CopyToOutput CopyToOutput - { - get - { - return this.m_CopyToOutput; - } - } - - public bool IsLink - { - get - { - return this.m_Link; - } - } - - public string LinkPath - { - get - { - return this.m_LinkPath; - } - } - /// - /// - /// - public string ResourceName - { - get - { - return m_ResourceName; - } - } - - public bool PreservePath - { - get - { - return m_PreservePath; - } - } - - #endregion - - #region Private Methods - - /// - /// Recurses the directories. - /// - /// The path. - /// The pattern. - /// if set to true [recurse]. - /// if set to true [use regex]. - private void RecurseDirectories(string path, string pattern, bool recurse, bool useRegex, ArrayList exclusions) - { - Match match; - Boolean excludeFile; - try - { - string[] files; - - if(!useRegex) - { - files = Directory.GetFiles(path, pattern); - if(files != null) - { - string fileTemp; - foreach (string file in files) - { - excludeFile = false; - if (file.Substring(0,2) == "./" || file.Substring(0,2) == ".\\") - { - fileTemp = file.Substring(2); - } - else - { - fileTemp = file; - } - - // Check all excludions and set flag if there are any hits. - foreach ( ExcludeNode exclude in exclusions ) - { - Regex exRegEx = new Regex( exclude.Pattern ); - match = exRegEx.Match( file ); - excludeFile |= match.Success; - } - - if ( !excludeFile ) - { - m_Files.Add( fileTemp ); - } - - } - } - else - { - return; - } - } - else - { - files = Directory.GetFiles(path); - foreach(string file in files) - { - excludeFile = false; - - match = m_Regex.Match(file); - if(match.Success) - { - // Check all excludions and set flag if there are any hits. - foreach ( ExcludeNode exclude in exclusions ) - { - Regex exRegEx = new Regex( exclude.Pattern ); - match = exRegEx.Match( file ); - excludeFile |= !match.Success; - } - - if ( !excludeFile ) - { - m_Files.Add( file ); - } - } - } - } - - if(recurse) - { - string[] dirs = Directory.GetDirectories(path); - if(dirs != null && dirs.Length > 0) - { - foreach(string str in dirs) - { - RecurseDirectories(Helper.NormalizePath(str), pattern, recurse, useRegex, exclusions); - } - } - } - } - catch(DirectoryNotFoundException) - { - return; - } - catch(ArgumentException) - { - return; - } - } - - #endregion - - #region Public Methods - - /// - /// - /// - /// - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - string path = Helper.AttributeValue(node, "path", "."); - string pattern = Helper.AttributeValue(node, "pattern", "*"); - bool recurse = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "recurse", "false")); - bool useRegex = (bool)Helper.TranslateValue(typeof(bool), Helper.AttributeValue(node, "useRegex", "false")); - string buildAction = Helper.AttributeValue(node, "buildAction", String.Empty); - if (buildAction != string.Empty) - m_BuildAction = (BuildAction)Enum.Parse(typeof(BuildAction), buildAction); - - //TODO: Figure out where the subtype node is being assigned - //string subType = Helper.AttributeValue(node, "subType", string.Empty); - //if (subType != String.Empty) - // m_SubType = (SubType)Enum.Parse(typeof(SubType), subType); - m_ResourceName = Helper.AttributeValue(node, "resourceName", m_ResourceName.ToString()); - this.m_CopyToOutput = (CopyToOutput) Enum.Parse(typeof(CopyToOutput), Helper.AttributeValue(node, "copyToOutput", this.m_CopyToOutput.ToString())); - this.m_Link = bool.Parse(Helper.AttributeValue(node, "link", bool.FalseString)); - if ( this.m_Link == true ) - { - this.m_LinkPath = Helper.AttributeValue( node, "linkPath", string.Empty ); - } - this.m_PreservePath = bool.Parse( Helper.AttributeValue( node, "preservePath", bool.FalseString ) ); - - - if(path != null && path.Length == 0) - { - path = ".";//use current directory - } - //throw new WarningException("Match must have a 'path' attribute"); - - if(pattern == null) - { - throw new WarningException("Match must have a 'pattern' attribute"); - } - - path = Helper.NormalizePath(path); - if(!Directory.Exists(path)) - { - throw new WarningException("Match path does not exist: {0}", path); - } - - try - { - if(useRegex) - { - m_Regex = new Regex(pattern); - } - } - catch(ArgumentException ex) - { - throw new WarningException("Could not compile regex pattern: {0}", ex.Message); - } - - - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is ExcludeNode) - { - ExcludeNode excludeNode = (ExcludeNode)dataNode; - m_Exclusions.Add( dataNode ); - } - } - - RecurseDirectories( path, pattern, recurse, useRegex, m_Exclusions ); - - if(m_Files.Count < 1) - { - throw new WarningException("Match returned no files: {0}{1}", Helper.EndPath(path), pattern); - } - m_Regex = null; - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/OptionsNode.cs b/Programs/Prebuild/src/Core/Nodes/OptionsNode.cs deleted file mode 100644 index b2d2fb46..00000000 --- a/Programs/Prebuild/src/Core/Nodes/OptionsNode.cs +++ /dev/null @@ -1,673 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2007-01-08 08:55:40 -0800 (Mon, 08 Jan 2007) $ - * $Revision: 197 $ - */ -#endregion - - - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Reflection; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Options")] - public class OptionsNode : DataNode - { - #region Fields - - private static Hashtable m_OptionFields; - - [OptionNode("CompilerDefines")] - private string m_CompilerDefines = ""; - - /// - /// - /// - public string CompilerDefines - { - get - { - return m_CompilerDefines; - } - set - { - m_CompilerDefines = value; - } - } - - [OptionNode("OptimizeCode")] - private bool m_OptimizeCode; - - /// - /// - /// - public bool OptimizeCode - { - get - { - return m_OptimizeCode; - } - set - { - m_OptimizeCode = value; - } - } - - [OptionNode("CheckUnderflowOverflow")] - private bool m_CheckUnderflowOverflow; - - /// - /// - /// - public bool CheckUnderflowOverflow - { - get - { - return m_CheckUnderflowOverflow; - } - set - { - m_CheckUnderflowOverflow = value; - } - } - - [OptionNode("AllowUnsafe")] - private bool m_AllowUnsafe; - - /// - /// - /// - public bool AllowUnsafe - { - get - { - return m_AllowUnsafe; - } - set - { - m_AllowUnsafe = value; - } - } - - [OptionNode("PreBuildEvent")] - private string m_PreBuildEvent; - - /// - /// - /// - public string PreBuildEvent - { - get - { - return m_PreBuildEvent; - } - set - { - m_PreBuildEvent = value; - } - } - - [OptionNode("PostBuildEvent")] - private string m_PostBuildEvent; - - /// - /// - /// - public string PostBuildEvent - { - get - { - return m_PostBuildEvent; - } - set - { - m_PostBuildEvent = value; - } - } - - [OptionNode("PreBuildEventArgs")] - private string m_PreBuildEventArgs; - - /// - /// - /// - public string PreBuildEventArgs - { - get - { - return m_PreBuildEventArgs; - } - set - { - m_PreBuildEventArgs = value; - } - } - - [OptionNode("PostBuildEventArgs")] - private string m_PostBuildEventArgs; - - /// - /// - /// - public string PostBuildEventArgs - { - get - { - return m_PostBuildEventArgs; - } - set - { - m_PostBuildEventArgs = value; - } - } - - [OptionNode("RunPostBuildEvent")] - private string m_RunPostBuildEvent; - - /// - /// - /// - public string RunPostBuildEvent - { - get - { - return m_RunPostBuildEvent; - } - set - { - m_RunPostBuildEvent = value; - } - } - - [OptionNode("RunScript")] - private string m_RunScript; - - /// - /// - /// - public string RunScript - { - get - { - return m_RunScript; - } - set - { - m_RunScript = value; - } - } - - [OptionNode("WarningLevel")] - private int m_WarningLevel = 4; - - /// - /// - /// - public int WarningLevel - { - get - { - return m_WarningLevel; - } - set - { - m_WarningLevel = value; - } - } - - [OptionNode("WarningsAsErrors")] - private bool m_WarningsAsErrors; - - /// - /// - /// - public bool WarningsAsErrors - { - get - { - return m_WarningsAsErrors; - } - set - { - m_WarningsAsErrors = value; - } - } - - [OptionNode("SuppressWarnings")] - private string m_SuppressWarnings = ""; - - /// - /// - /// - public string SuppressWarnings - { - get - { - return m_SuppressWarnings; - } - set - { - m_SuppressWarnings = value; - } - } - - [OptionNode("OutputPath")] - private string m_OutputPath = "bin/"; - - /// - /// - /// - public string OutputPath - { - get - { - return m_OutputPath; - } - set - { - m_OutputPath = value; - } - } - - [OptionNode("GenerateDocumentation")] - private bool m_GenerateDocumentation; - - /// - /// - /// - public bool GenerateDocumentation - { - get - { - return m_GenerateDocumentation; - } - set - { - m_GenerateDocumentation = value; - } - } - - [OptionNode("GenerateXmlDocFile")] - private bool m_GenerateXmlDocFile; - - /// - /// - /// - public bool GenerateXmlDocFile - { - get - { - return m_GenerateXmlDocFile; - } - set - { - m_GenerateXmlDocFile = value; - } - } - - [OptionNode("XmlDocFile")] - private string m_XmlDocFile = ""; - - /// - /// - /// - public string XmlDocFile - { - get - { - return m_XmlDocFile; - } - set - { - m_XmlDocFile = value; - } - } - - [OptionNode("KeyFile")] - private string m_KeyFile = ""; - - /// - /// - /// - public string KeyFile - { - get - { - return m_KeyFile; - } - set - { - m_KeyFile = value; - } - } - - [OptionNode("DebugInformation")] - private bool m_DebugInformation; - - /// - /// - /// - public bool DebugInformation - { - get - { - return m_DebugInformation; - } - set - { - m_DebugInformation = value; - } - } - - [OptionNode("RegisterComInterop")] - private bool m_RegisterComInterop; - - /// - /// - /// - public bool RegisterComInterop - { - get - { - return m_RegisterComInterop; - } - set - { - m_RegisterComInterop = value; - } - } - - [OptionNode("RemoveIntegerChecks")] - private bool m_RemoveIntegerChecks; - - /// - /// - /// - public bool RemoveIntegerChecks - { - get - { - return m_RemoveIntegerChecks; - } - set - { - m_RemoveIntegerChecks = value; - } - } - - [OptionNode("IncrementalBuild")] - private bool m_IncrementalBuild; - - /// - /// - /// - public bool IncrementalBuild - { - get - { - return m_IncrementalBuild; - } - set - { - m_IncrementalBuild = value; - } - } - - [OptionNode("BaseAddress")] - private string m_BaseAddress = "285212672"; - - /// - /// - /// - public string BaseAddress - { - get - { - return m_BaseAddress; - } - set - { - m_BaseAddress = value; - } - } - - [OptionNode("FileAlignment")] - private int m_FileAlignment = 4096; - - /// - /// - /// - public int FileAlignment - { - get - { - return m_FileAlignment; - } - set - { - m_FileAlignment = value; - } - } - - [OptionNode("NoStdLib")] - private bool m_NoStdLib; - - /// - /// - /// - public bool NoStdLib - { - get - { - return m_NoStdLib; - } - set - { - m_NoStdLib = value; - } - } - - [OptionNode("PlatformTarget")] - private string m_PlatformTarget = "AnyCPU"; - - /// - /// - /// - public string PlatformTarget - { - get - { - return m_PlatformTarget; - } - set - { - m_PlatformTarget = value; - } - } - - private StringCollection m_FieldsDefined; - - #endregion - - #region Constructors - - /// - /// Initializes the class. - /// - static OptionsNode() - { - Type t = typeof(OptionsNode); - - m_OptionFields = new Hashtable(); - foreach(FieldInfo f in t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance)) - { - object[] attrs = f.GetCustomAttributes(typeof(OptionNodeAttribute), false); - if(attrs == null || attrs.Length < 1) - { - continue; - } - - OptionNodeAttribute ona = (OptionNodeAttribute)attrs[0]; - m_OptionFields[ona.NodeName] = f; - } - } - - /// - /// Initializes a new instance of the class. - /// - public OptionsNode() - { - m_FieldsDefined = new StringCollection(); - } - - #endregion - - #region Properties - - /// - /// Gets the at the specified index. - /// - /// - public object this[string index] - { - get - { - if(!m_OptionFields.ContainsKey(index)) - { - return null; - } - - FieldInfo f = (FieldInfo)m_OptionFields[index]; - return f.GetValue(this); - } - } - - /// - /// Gets the at the specified index. - /// - /// - public object this[string index, object defaultValue] - { - get - { - object valueObject = this[index]; - if(valueObject != null && valueObject is string && ((string)valueObject).Length == 0) - { - return defaultValue; - } - return valueObject; - } - } - - - #endregion - - #region Private Methods - - private void FlagDefined(string name) - { - if(!m_FieldsDefined.Contains(name)) - { - m_FieldsDefined.Add(name); - } - } - - private void SetOption(string nodeName, string val) - { - lock(m_OptionFields) - { - if(!m_OptionFields.ContainsKey(nodeName)) - { - return; - } - - FieldInfo f = (FieldInfo)m_OptionFields[nodeName]; - f.SetValue(this, Helper.TranslateValue(f.FieldType, val)); - FlagDefined(f.Name); - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - foreach(XmlNode child in node.ChildNodes) - { - SetOption(child.Name, Helper.InterpolateForEnvironmentVariables(child.InnerText)); - } - } - - /// - /// Copies to. - /// - /// The opt. - public void CopyTo(OptionsNode opt) - { - if(opt == null) - { - return; - } - - foreach(FieldInfo f in m_OptionFields.Values) - { - if(m_FieldsDefined.Contains(f.Name)) - { - f.SetValue(opt, f.GetValue(this)); - opt.m_FieldsDefined.Add(f.Name); - } - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/ProcessNode.cs b/Programs/Prebuild/src/Core/Nodes/ProcessNode.cs deleted file mode 100644 index ce6a2fe8..00000000 --- a/Programs/Prebuild/src/Core/Nodes/ProcessNode.cs +++ /dev/null @@ -1,119 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Process")] - public class ProcessNode : DataNode - { - #region Fields - - private string m_Path; - private bool m_IsValid = true; - - #endregion - - #region Properties - - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - /// - /// Gets a value indicating whether this instance is valid. - /// - /// true if this instance is valid; otherwise, false. - public bool IsValid - { - get - { - return m_IsValid; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Path == null) - { - m_Path = ""; - } - - try - { - m_Path = Helper.ResolvePath(m_Path); - } - catch(ArgumentException) - { - Kernel.Instance.Log.Write(LogType.Warning, "Could not find prebuild file for processing: {0}", m_Path); - m_IsValid = false; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/ProjectNode.cs b/Programs/Prebuild/src/Core/Nodes/ProjectNode.cs deleted file mode 100644 index 5ea66801..00000000 --- a/Programs/Prebuild/src/Core/Nodes/ProjectNode.cs +++ /dev/null @@ -1,580 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: sontek $ - * $Date: 2008-06-16 16:37:58 -0700 (Mon, 16 Jun 2008) $ - * $Revision: 275 $ - */ -#endregion - -using System; -using System.Collections; -using System.IO; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// A set of values that the Project's type can be - /// - public enum ProjectType - { - /// - /// The project is a console executable - /// - Exe, - /// - /// The project is a windows executable - /// - WinExe, - /// - /// The project is a library - /// - Library, - /// - /// The project is a website - /// - Web, - } - - /// - /// - /// - public enum ClrRuntime - { - /// - /// - /// - Microsoft, - /// - /// - /// - Mono - } - /// - /// The version of the .NET framework to use (Required for VS2008) - /// We don't need .NET 1.1 in here, it'll default when using vs2003. - /// - public enum FrameworkVersion - { - /// - /// .NET 2.0 - /// - v2_0, - /// - /// .NET 3.0 - /// - v3_0, - /// - /// .NET 3.5 - /// - v3_5, - /// - /// .NET 4.0 - /// - v4_0, - /// - /// .NET 4.5 - /// - v4_5, - } - /// - /// The Node object representing /Prebuild/Solution/Project elements - /// - [DataNode("Project")] - public class ProjectNode : DataNode - { - #region Fields - - private string m_Name = "unknown"; - private string m_Path = ""; - private string m_FullPath = ""; - private string m_AssemblyName; - private string m_AppIcon = ""; - private string m_ConfigFile = ""; - private string m_DesignerFolder = ""; - private string m_Language = "C#"; - private ProjectType m_Type = ProjectType.Exe; - private ClrRuntime m_Runtime = ClrRuntime.Microsoft; - private FrameworkVersion m_Framework = FrameworkVersion.v2_0; - private string m_StartupObject = ""; - private string m_RootNamespace; - private string m_FilterGroups = ""; - private string m_Version = ""; - private Guid m_Guid; - - private Hashtable m_Configurations; - private ArrayList m_ReferencePaths; - private ArrayList m_References; - private ArrayList m_Authors; - private FilesNode m_Files; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public ProjectNode() - { - m_Configurations = new Hashtable(); - m_ReferencePaths = new ArrayList(); - m_References = new ArrayList(); - m_Authors = new ArrayList(); - } - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - /// - /// The version of the .NET Framework to compile under - /// - public FrameworkVersion FrameworkVersion - { - get - { - return this.m_Framework; - } - } - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - /// - /// Gets the filter groups. - /// - /// The filter groups. - public string FilterGroups - { - get - { - return m_FilterGroups; - } - } - - /// - /// Gets the project's version - /// - /// The project's version. - public string Version - { - get - { - return m_Version; - } - } - - /// - /// Gets the full path. - /// - /// The full path. - public string FullPath - { - get - { - return m_FullPath; - } - } - - /// - /// Gets the name of the assembly. - /// - /// The name of the assembly. - public string AssemblyName - { - get - { - return m_AssemblyName; - } - } - - /// - /// Gets the app icon. - /// - /// The app icon. - public string AppIcon - { - get - { - return m_AppIcon; - } - } - - /// - /// Gets the app icon. - /// - /// The app icon. - public string ConfigFile - { - get - { - return m_ConfigFile; - } - } - - /// - /// - /// - public string DesignerFolder - { - get - { - return m_DesignerFolder; - } - } - - /// - /// Gets the language. - /// - /// The language. - public string Language - { - get - { - return m_Language; - } - } - - /// - /// Gets the type. - /// - /// The type. - public ProjectType Type - { - get - { - return m_Type; - } - } - - /// - /// Gets the runtime. - /// - /// The runtime. - public ClrRuntime Runtime - { - get - { - return m_Runtime; - } - } - - private bool m_GenerateAssemblyInfoFile = false; - - /// - /// - /// - public bool GenerateAssemblyInfoFile - { - get - { - return m_GenerateAssemblyInfoFile; - } - set - { - m_GenerateAssemblyInfoFile = value; - } - } - - /// - /// Gets the startup object. - /// - /// The startup object. - public string StartupObject - { - get - { - return m_StartupObject; - } - } - - /// - /// Gets the root namespace. - /// - /// The root namespace. - public string RootNamespace - { - get - { - return m_RootNamespace; - } - } - - /// - /// Gets the configurations. - /// - /// The configurations. - public ICollection Configurations - { - get - { - return m_Configurations.Values; - } - } - - /// - /// Gets the configurations table. - /// - /// The configurations table. - public Hashtable ConfigurationsTable - { - get - { - return m_Configurations; - } - } - - /// - /// Gets the reference paths. - /// - /// The reference paths. - public ArrayList ReferencePaths - { - get - { - return m_ReferencePaths; - } - } - - /// - /// Gets the references. - /// - /// The references. - public ArrayList References - { - get - { - return m_References; - } - } - - /// - /// Gets the Authors list. - /// - /// The list of the project's authors. - public ArrayList Authors - { - get - { - return m_Authors; - } - } - - /// - /// Gets the files. - /// - /// The files. - public FilesNode Files - { - get - { - return m_Files; - } - } - - /// - /// Gets or sets the parent. - /// - /// The parent. - public override IDataNode Parent - { - get - { - return base.Parent; - } - set - { - base.Parent = value; - if(base.Parent is SolutionNode && m_Configurations.Count < 1) - { - SolutionNode parent = (SolutionNode)base.Parent; - foreach(ConfigurationNode conf in parent.Configurations) - { - m_Configurations[conf.Name] = conf.Clone(); - } - } - } - } - - /// - /// Gets the GUID. - /// - /// The GUID. - public Guid Guid - { - get - { - return m_Guid; - } - } - - #endregion - - #region Private Methods - - private void HandleConfiguration(ConfigurationNode conf) - { - if(String.Compare(conf.Name, "all", true) == 0) //apply changes to all, this may not always be applied first, - //so it *may* override changes to the same properties for configurations defines at the project level - { - foreach(ConfigurationNode confNode in this.m_Configurations.Values) - { - conf.CopyTo(confNode);//update the config templates defines at the project level with the overrides - } - } - if(m_Configurations.ContainsKey(conf.Name)) - { - ConfigurationNode parentConf = (ConfigurationNode)m_Configurations[conf.Name]; - conf.CopyTo(parentConf);//update the config templates defines at the project level with the overrides - } - else - { - m_Configurations[conf.Name] = conf; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Name = Helper.AttributeValue(node, "name", m_Name); - m_Path = Helper.AttributeValue(node, "path", m_Path); - m_FilterGroups = Helper.AttributeValue(node, "filterGroups", m_FilterGroups); - m_Version = Helper.AttributeValue(node, "version", m_Version); - m_AppIcon = Helper.AttributeValue(node, "icon", m_AppIcon); - m_ConfigFile = Helper.AttributeValue(node, "configFile", m_ConfigFile); - m_DesignerFolder = Helper.AttributeValue(node, "designerFolder", m_DesignerFolder); - m_AssemblyName = Helper.AttributeValue(node, "assemblyName", m_AssemblyName); - m_Language = Helper.AttributeValue(node, "language", m_Language); - m_Type = (ProjectType)Helper.EnumAttributeValue(node, "type", typeof(ProjectType), m_Type); - m_Runtime = (ClrRuntime)Helper.EnumAttributeValue(node, "runtime", typeof(ClrRuntime), m_Runtime); - m_Framework = (FrameworkVersion)Helper.EnumAttributeValue(node, "frameworkVersion", typeof(FrameworkVersion), m_Framework); - m_StartupObject = Helper.AttributeValue(node, "startupObject", m_StartupObject); - m_RootNamespace = Helper.AttributeValue(node, "rootNamespace", m_RootNamespace); - - string guid = Helper.AttributeValue(node, "guid", Guid.NewGuid().ToString()); - m_Guid = new Guid(guid); - - m_GenerateAssemblyInfoFile = Helper.ParseBoolean(node, "generateAssemblyInfoFile", false); - - if(m_AssemblyName == null || m_AssemblyName.Length < 1) - { - m_AssemblyName = m_Name; - } - - if(m_RootNamespace == null || m_RootNamespace.Length < 1) - { - m_RootNamespace = m_Name; - } - - m_FullPath = m_Path; - try - { - m_FullPath = Helper.ResolvePath(m_FullPath); - } - catch - { - throw new WarningException("Could not resolve Solution path: {0}", m_Path); - } - - Kernel.Instance.CurrentWorkingDirectory.Push(); - try - { - Helper.SetCurrentDir(m_FullPath); - - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is ConfigurationNode) - { - HandleConfiguration((ConfigurationNode)dataNode); - } - else if(dataNode is ReferencePathNode) - { - m_ReferencePaths.Add(dataNode); - } - else if(dataNode is ReferenceNode) - { - m_References.Add(dataNode); - } - else if(dataNode is AuthorNode) - { - m_Authors.Add(dataNode); - } - else if(dataNode is FilesNode) - { - m_Files = (FilesNode)dataNode; - } - } - } - finally - { - Kernel.Instance.CurrentWorkingDirectory.Pop(); - } - } - - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/ReferenceNode.cs b/Programs/Prebuild/src/Core/Nodes/ReferenceNode.cs deleted file mode 100644 index acc74561..00000000 --- a/Programs/Prebuild/src/Core/Nodes/ReferenceNode.cs +++ /dev/null @@ -1,147 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-07-25 09:56:49 -0700 (Tue, 25 Jul 2006) $ - * $Revision: 132 $ - */ -#endregion - -using System; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Reference")] - public class ReferenceNode : DataNode - { - #region Fields - - private string m_Name = "unknown"; - private string m_Path; - private string m_LocalCopy; - private string m_Version; - - #endregion - - #region Properties - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - set - { - m_Name = value; - } - } - - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - /// - /// Gets a value indicating whether [local copy specified]. - /// - /// true if [local copy specified]; otherwise, false. - public bool LocalCopySpecified - { - get - { - return ( m_LocalCopy != null && m_LocalCopy.Length == 0); - } - } - - /// - /// Gets a value indicating whether [local copy]. - /// - /// true if [local copy]; otherwise, false. - public bool LocalCopy - { - get - { - if( m_LocalCopy == null) - { - return false; - } - return bool.Parse(m_LocalCopy); - } - } - - /// - /// Gets the version. - /// - /// The version. - public string Version - { - get - { - return m_Version; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Name = Helper.AttributeValue(node, "name", m_Name); - m_Path = Helper.AttributeValue(node, "path", m_Path); - m_LocalCopy = Helper.AttributeValue(node, "localCopy", m_LocalCopy); - m_Version = Helper.AttributeValue(node, "version", m_Version); - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/ReferencePathNode.cs b/Programs/Prebuild/src/Core/Nodes/ReferencePathNode.cs deleted file mode 100644 index 606256bd..00000000 --- a/Programs/Prebuild/src/Core/Nodes/ReferencePathNode.cs +++ /dev/null @@ -1,98 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("ReferencePath")] - public class ReferencePathNode : DataNode - { - #region Fields - - private string m_Path; - - #endregion - - #region Properties - - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - m_Path = Helper.InterpolateForEnvironmentVariables(node.InnerText); - if(m_Path == null) - { - m_Path = ""; - } - - m_Path = m_Path.Trim(); - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Nodes/SolutionNode.cs b/Programs/Prebuild/src/Core/Nodes/SolutionNode.cs deleted file mode 100644 index 7c70545a..00000000 --- a/Programs/Prebuild/src/Core/Nodes/SolutionNode.cs +++ /dev/null @@ -1,364 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: sontek $ - * $Date: 2008-04-30 16:36:53 -0700 (Wed, 30 Apr 2008) $ - * $Revision: 267 $ - */ -#endregion - -using System; -using System.Collections; -using System.Diagnostics; -using System.IO; -using System.Xml; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Nodes -{ - /// - /// - /// - [DataNode("Solution")] - [DataNode("EmbeddedSolution")] - [DebuggerDisplay("{Name}")] - public class SolutionNode : DataNode - { - #region Fields - - private Guid m_Guid = Guid.NewGuid(); - private string m_Name = "unknown"; - private string m_Path = ""; - private string m_FullPath = ""; - private string m_ActiveConfig = "Debug"; - - private OptionsNode m_Options; - private FilesNode m_Files; - private Hashtable m_Configurations; - private Hashtable m_Projects; - private Hashtable m_DatabaseProjects; - private ArrayList m_ProjectsOrder; - private Hashtable m_Solutions; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public SolutionNode() - { - m_Configurations = new Hashtable(); - m_Projects = new Hashtable(); - m_ProjectsOrder = new ArrayList(); - m_DatabaseProjects = new Hashtable(); - m_Solutions = new Hashtable(); - } - - #endregion - - #region Properties - public override IDataNode Parent - { - get - { - return base.Parent; - } - set - { - if (value is SolutionNode) - { - SolutionNode solution = (SolutionNode)value; - foreach (ConfigurationNode conf in solution.Configurations) - { - m_Configurations[conf.Name] = conf.Clone(); - } - } - - base.Parent = value; - } - } - - public Guid Guid - { - get - { - return m_Guid; - } - set - { - m_Guid = value; - } - } - /// - /// Gets or sets the active config. - /// - /// The active config. - public string ActiveConfig - { - get - { - return m_ActiveConfig; - } - set - { - m_ActiveConfig = value; - } - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return m_Name; - } - } - - /// - /// Gets the path. - /// - /// The path. - public string Path - { - get - { - return m_Path; - } - } - - /// - /// Gets the full path. - /// - /// The full path. - public string FullPath - { - get - { - return m_FullPath; - } - } - - /// - /// Gets the options. - /// - /// The options. - public OptionsNode Options - { - get - { - return m_Options; - } - } - - /// - /// Gets the files. - /// - /// The files. - public FilesNode Files - { - get - { - return m_Files; - } - } - - /// - /// Gets the configurations. - /// - /// The configurations. - public ICollection Configurations - { - get - { - return m_Configurations.Values; - } - } - - /// - /// Gets the configurations table. - /// - /// The configurations table. - public Hashtable ConfigurationsTable - { - get - { - return m_Configurations; - } - } - /// - /// Gets the database projects. - /// - public ICollection DatabaseProjects - { - get - { - return m_DatabaseProjects.Values; - } - } - /// - /// Gets the nested solutions. - /// - public ICollection Solutions - { - get - { - return m_Solutions.Values; - } - } - /// - /// Gets the nested solutions hash table. - /// - public Hashtable SolutionsTable - { - get - { - return this.m_Solutions; - } - } - /// - /// Gets the projects. - /// - /// The projects. - public ICollection Projects - { - get - { - return m_Projects.Values; - } - } - - /// - /// Gets the projects table. - /// - /// The projects table. - public Hashtable ProjectsTable - { - get - { - return m_Projects; - } - } - - /// - /// Gets the projects table. - /// - /// The projects table. - public ArrayList ProjectsTableOrder - { - get - { - return m_ProjectsOrder; - } - } - - #endregion - - #region Public Methods - - /// - /// Parses the specified node. - /// - /// The node. - public override void Parse(XmlNode node) - { - m_Name = Helper.AttributeValue(node, "name", m_Name); - m_ActiveConfig = Helper.AttributeValue(node, "activeConfig", m_ActiveConfig); - m_Path = Helper.AttributeValue(node, "path", m_Path); - - m_FullPath = m_Path; - try - { - m_FullPath = Helper.ResolvePath(m_FullPath); - } - catch - { - throw new WarningException("Could not resolve solution path: {0}", m_Path); - } - - Kernel.Instance.CurrentWorkingDirectory.Push(); - try - { - Helper.SetCurrentDir(m_FullPath); - - if( node == null ) - { - throw new ArgumentNullException("node"); - } - - foreach(XmlNode child in node.ChildNodes) - { - IDataNode dataNode = Kernel.Instance.ParseNode(child, this); - if(dataNode is OptionsNode) - { - m_Options = (OptionsNode)dataNode; - } - else if(dataNode is FilesNode) - { - m_Files = (FilesNode)dataNode; - } - else if(dataNode is ConfigurationNode) - { - m_Configurations[((ConfigurationNode)dataNode).Name] = dataNode; - } - else if(dataNode is ProjectNode) - { - m_Projects[((ProjectNode)dataNode).Name] = dataNode; - m_ProjectsOrder.Add(dataNode); - } - else if(dataNode is SolutionNode) - { - m_Solutions[((SolutionNode)dataNode).Name] = dataNode; - } - else if (dataNode is ProcessNode) - { - ProcessNode p = (ProcessNode)dataNode; - Kernel.Instance.ProcessFile(p, this); - } - else if (dataNode is DatabaseProjectNode) - { - m_DatabaseProjects[((DatabaseProjectNode)dataNode).Name] = dataNode; - } - } - } - finally - { - Kernel.Instance.CurrentWorkingDirectory.Pop(); - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Parse/IfContext.cs b/Programs/Prebuild/src/Core/Parse/IfContext.cs deleted file mode 100644 index 7170a9ac..00000000 --- a/Programs/Prebuild/src/Core/Parse/IfContext.cs +++ /dev/null @@ -1,163 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; - -namespace Prebuild.Core.Parse -{ - /// - /// - /// - public enum IfState - { - /// - /// - /// - None, - /// - /// - /// - If, - /// - /// - /// - ElseIf, - /// - /// - /// - Else - } - - /// - /// Summary description for IfContext. - /// - // Inspired by the equivalent WiX class (see www.sourceforge.net/projects/wix/) - public class IfContext - { - #region Properties - - bool m_Active; - bool m_Keep; - bool m_EverKept; - IfState m_State = IfState.None; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// if set to true [active]. - /// if set to true [keep]. - /// The state. - public IfContext(bool active, bool keep, IfState state) - { - m_Active = active; - m_Keep = keep; - m_EverKept = keep; - m_State = state; - } - - #endregion - - #region Properties - - /// - /// Gets or sets a value indicating whether this is active. - /// - /// true if active; otherwise, false. - public bool Active - { - get - { - return m_Active; - } - set - { - m_Active = value; - } - } - - /// - /// Gets or sets a value indicating whether this is keep. - /// - /// true if keep; otherwise, false. - public bool Keep - { - get - { - return m_Keep; - } - set - { - m_Keep = value; - if(m_Keep) - { - m_EverKept = true; - } - } - } - - /// - /// Gets a value indicating whether [ever kept]. - /// - /// true if [ever kept]; otherwise, false. - public bool EverKept - { - get - { - return m_EverKept; - } - } - - /// - /// Gets or sets the state. - /// - /// The state. - public IfState State - { - get - { - return m_State; - } - set - { - m_State = value; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Parse/Preprocessor.cs b/Programs/Prebuild/src/Core/Parse/Preprocessor.cs deleted file mode 100644 index 4d56c0fc..00000000 --- a/Programs/Prebuild/src/Core/Parse/Preprocessor.cs +++ /dev/null @@ -1,591 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: dmoonfire $ - * $Date: 2008-12-09 18:26:03 -0800 (Tue, 09 Dec 2008) $ - * $Revision: 280 $ - */ -#endregion - -using System; -using System.Collections; -using System.IO; -using System.Text.RegularExpressions; -using System.Xml; - -namespace Prebuild.Core.Parse -{ - /// - /// - /// - public enum OperatorSymbol - { - /// - /// - /// - None, - /// - /// - /// - Equal, - /// - /// - /// - NotEqual, - /// - /// - /// - LessThan, - /// - /// - /// - GreaterThan, - /// - /// - /// - LessThanEqual, - /// - /// - /// - GreaterThanEqual - } - - /// - /// - /// - public class Preprocessor - { - #region Constants - - /// - /// Includes the regex to look for file tags in the processing instruction. - /// - private static readonly Regex includeFileRegex = new Regex("file=\"(.+?)\""); - - #endregion - - #region Fields - - XmlDocument m_OutDoc; - Stack m_IfStack; - Hashtable m_Variables; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public Preprocessor() - { - m_OutDoc = new XmlDocument(); - m_IfStack = new Stack(); - m_Variables = new Hashtable(); - - RegisterVariable("OS", GetOS()); - RegisterVariable("RuntimeVersion", Environment.Version.Major); - RegisterVariable("RuntimeMajor", Environment.Version.Major); - RegisterVariable("RuntimeMinor", Environment.Version.Minor); - RegisterVariable("RuntimeRevision", Environment.Version.Revision); - } - - #endregion - - #region Properties - - /// - /// Gets the processed doc. - /// - /// The processed doc. - public XmlDocument ProcessedDoc - { - get - { - return m_OutDoc; - } - } - - #endregion - - #region Private Methods - - /// - /// Parts of this code were taken from NAnt and is subject to the GPL - /// as per NAnt's license. Thanks to the NAnt guys for this little gem. - /// - /// - public static string GetOS() - { - PlatformID platId = Environment.OSVersion.Platform; - if(platId == PlatformID.Win32NT || platId == PlatformID.Win32Windows) - { - return "Win32"; - } - - if (File.Exists("/System/Library/Frameworks/Cocoa.framework/Cocoa")) - { - return "MACOSX"; - } - - /* - * .NET 1.x, under Mono, the UNIX code is 128. Under - * .NET 2.x, Mono or MS, the UNIX code is 4 - */ - if(Environment.Version.Major == 1) - { - if((int)platId == 128) - { - return "UNIX"; - } - } - else if((int)platId == 4) - { - return "UNIX"; - } - - return "Unknown"; - } - - private static bool CompareNum(OperatorSymbol oper, int val1, int val2) - { - switch(oper) - { - case OperatorSymbol.Equal: - return (val1 == val2); - case OperatorSymbol.NotEqual: - return (val1 != val2); - case OperatorSymbol.LessThan: - return (val1 < val2); - case OperatorSymbol.LessThanEqual: - return (val1 <= val2); - case OperatorSymbol.GreaterThan: - return (val1 > val2); - case OperatorSymbol.GreaterThanEqual: - return (val1 >= val2); - } - - throw new WarningException("Unknown operator type"); - } - - private static bool CompareStr(OperatorSymbol oper, string val1, string val2) - { - switch(oper) - { - case OperatorSymbol.Equal: - return (val1 == val2); - case OperatorSymbol.NotEqual: - return (val1 != val2); - case OperatorSymbol.LessThan: - return (val1.CompareTo(val2) < 0); - case OperatorSymbol.LessThanEqual: - return (val1.CompareTo(val2) <= 0); - case OperatorSymbol.GreaterThan: - return (val1.CompareTo(val2) > 0); - case OperatorSymbol.GreaterThanEqual: - return (val1.CompareTo(val2) >= 0); - } - - throw new WarningException("Unknown operator type"); - } - - private static char NextChar(int idx, string str) - { - if((idx + 1) >= str.Length) - { - return Char.MaxValue; - } - - return str[idx + 1]; - } - // Very very simple expression parser. Can only match expressions of the form - // : - // OS = Windows - // OS != Linux - // RuntimeMinor > 0 - private bool ParseExpression(string exp) - { - if(exp == null) - { - throw new ArgumentException("Invalid expression, cannot be null"); - } - - exp = exp.Trim(); - if(exp.Length < 1) - { - throw new ArgumentException("Invalid expression, cannot be 0 length"); - } - - string id = ""; - string str = ""; - OperatorSymbol oper = OperatorSymbol.None; - bool inStr = false; - char c; - - for(int i = 0; i < exp.Length; i++) - { - c = exp[i]; - if(Char.IsWhiteSpace(c)) - { - continue; - } - - if(Char.IsLetterOrDigit(c) || c == '_') - { - if(inStr) - { - str += c; - } - else - { - id += c; - } - } - else if(c == '\"') - { - inStr = !inStr; - if(inStr) - { - str = ""; - } - } - else - { - if(inStr) - { - str += c; - } - else - { - switch(c) - { - case '=': - oper = OperatorSymbol.Equal; - break; - - case '!': - if(NextChar(i, exp) == '=') - { - oper = OperatorSymbol.NotEqual; - } - - break; - - case '<': - if(NextChar(i, exp) == '=') - { - oper = OperatorSymbol.LessThanEqual; - } - else - { - oper = OperatorSymbol.LessThan; - } - - break; - - case '>': - if(NextChar(i, exp) == '=') - { - oper = OperatorSymbol.GreaterThanEqual; - } - else - { - oper = OperatorSymbol.GreaterThan; - } - - break; - } - } - } - } - - - if(inStr) - { - throw new WarningException("Expected end of string in expression"); - } - - if(oper == OperatorSymbol.None) - { - throw new WarningException("Expected operator in expression"); - } - else if(id.Length < 1) - { - throw new WarningException("Expected identifier in expression"); - } - else if(str.Length < 1) - { - throw new WarningException("Expected value in expression"); - } - - bool ret = false; - try - { - object val = m_Variables[id.ToLower()]; - if(val == null) - { - throw new WarningException("Unknown identifier '{0}'", id); - } - - int numVal, numVal2; - string strVal, strVal2; - Type t = val.GetType(); - if(t.IsAssignableFrom(typeof(int))) - { - numVal = (int)val; - numVal2 = Int32.Parse(str); - ret = CompareNum(oper, numVal, numVal2); - } - else - { - strVal = val.ToString(); - strVal2 = str; - ret = CompareStr(oper, strVal, strVal2); - } - } - catch(ArgumentException ex) - { - ex.ToString(); - throw new WarningException("Invalid value type for system variable '{0}', expected int", id); - } - - return ret; - } - - #endregion - - #region Public Methods - - /// - /// - /// - /// - /// - public void RegisterVariable(string name, object variableValue) - { - if(name == null || variableValue == null) - { - return; - } - - m_Variables[name.ToLower()] = variableValue; - } - - /// - /// Performs validation on the xml source as well as evaluates conditional and flow expresions - /// - /// For invalid use of conditional expressions or for invalid XML syntax. If a XmlValidatingReader is passed, then will also throw exceptions for non-schema-conforming xml - /// - /// the output xml - public string Process(XmlReader initialReader) - { - if(initialReader == null) - { - throw new ArgumentException("Invalid XML reader to pre-process"); - } - - IfContext context = new IfContext(true, true, IfState.None); - StringWriter xmlText = new StringWriter(); - XmlTextWriter writer = new XmlTextWriter(xmlText); - writer.Formatting = Formatting.Indented; - - // Create a queue of XML readers and add the initial - // reader to it. Then we process until we run out of - // readers which lets the operation add more - // readers to generate a multi-file parser and not require - // XML fragments that a recursive version would use. - Stack readerStack = new Stack(); - readerStack.Push(initialReader); - - while(readerStack.Count > 0) - { - // Pop off the next reader. - XmlReader reader = (XmlReader) readerStack.Pop(); - - // Process through this XML reader until it is - // completed (or it is replaced by the include - // operation). - while(reader.Read()) - { - // The prebuild file has a series of processing - // instructions which allow for specific - // inclusions based on operating system or to - // include additional files. - if(reader.NodeType == XmlNodeType.ProcessingInstruction) - { - bool ignore = false; - - switch(reader.LocalName) - { - case "include": - // use regular expressions to parse out the attributes. - MatchCollection matches = includeFileRegex.Matches(reader.Value); - - // make sure there is only one file attribute. - if(matches.Count > 1) - { - throw new WarningException("An node was found, but it specified more than one file."); - } - - if(matches.Count == 0) - { - throw new WarningException("An node was found, but it did not specify the file attribute."); - } - - // Pull the file out from the regex and make sure it is a valid file before using it. - string filename = matches[0].Groups[1].Value; - FileInfo includeFile = new FileInfo(filename); - - if(!includeFile.Exists) - { - throw new WarningException("Cannot include file: " + includeFile.FullName); - } - - // Create a new reader object for this file. Then put the old reader back on the stack and start - // processing using this new XML reader. - XmlReader newReader = new XmlTextReader(includeFile.Open(FileMode.Open, FileAccess.Read, FileShare.Read)); - - readerStack.Push(reader); - reader = newReader; - ignore = true; - break; - - case "if": - m_IfStack.Push(context); - context = new IfContext(context.Keep & context.Active, ParseExpression(reader.Value), IfState.If); - ignore = true; - break; - - case "elseif": - if(m_IfStack.Count == 0) - { - throw new WarningException("Unexpected 'elseif' outside of 'if'"); - } - else if(context.State != IfState.If && context.State != IfState.ElseIf) - { - throw new WarningException("Unexpected 'elseif' outside of 'if'"); - } - - context.State = IfState.ElseIf; - if(!context.EverKept) - { - context.Keep = ParseExpression(reader.Value); - } - else - { - context.Keep = false; - } - - ignore = true; - break; - - case "else": - if(m_IfStack.Count == 0) - { - throw new WarningException("Unexpected 'else' outside of 'if'"); - } - else if(context.State != IfState.If && context.State != IfState.ElseIf) - { - throw new WarningException("Unexpected 'else' outside of 'if'"); - } - - context.State = IfState.Else; - context.Keep = !context.EverKept; - ignore = true; - break; - - case "endif": - if(m_IfStack.Count == 0) - { - throw new WarningException("Unexpected 'endif' outside of 'if'"); - } - - context = (IfContext)m_IfStack.Pop(); - ignore = true; - break; - } - - if(ignore) - { - continue; - } - }//end pre-proc instruction - - if(!context.Active || !context.Keep) - { - continue; - } - - switch(reader.NodeType) - { - case XmlNodeType.Element: - bool empty = reader.IsEmptyElement; - writer.WriteStartElement(reader.Name); - - while (reader.MoveToNextAttribute()) - { - writer.WriteAttributeString(reader.Name, reader.Value); - } - - if(empty) - { - writer.WriteEndElement(); - } - - break; - - case XmlNodeType.EndElement: - writer.WriteEndElement(); - break; - - case XmlNodeType.Text: - writer.WriteString(reader.Value); - break; - - case XmlNodeType.CDATA: - writer.WriteCData(reader.Value); - break; - - default: - break; - } - } - - if(m_IfStack.Count != 0) - { - throw new WarningException("Mismatched 'if', 'endif' pair"); - } - } - - return xmlText.ToString(); - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/AutotoolsTarget.cs b/Programs/Prebuild/src/Core/Targets/AutotoolsTarget.cs deleted file mode 100644 index 9d1704b6..00000000 --- a/Programs/Prebuild/src/Core/Targets/AutotoolsTarget.cs +++ /dev/null @@ -1,1810 +0,0 @@ -#region BSD License -/* - -Copyright (c) 2004 - 2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -Dave Hudson (jendave@yahoo.com), -C.J. Adams-Collier (cjac@colliertech.org), - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote -products derived from this software without specific prior written -permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ -#endregion - -#region MIT X11 license - -/* - Portions of this file authored by Lluis Sanchez Gual - - Copyright (C) 2006 Novell, Inc (http://www.novell.com) - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-07-28 22:43:24 -0700 (Fri, 28 Jul 2006) $ - * $Revision: 136 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; -using System.Xml.Xsl; -using System.Net; -using System.Diagnostics; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Parse; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - public enum ClrVersion - { - Default, - Net_1_1, - Net_2_0 - } - - public class SystemPackage - { - string name; - string version; - string description; - string[] assemblies; - bool isInternal; - ClrVersion targetVersion; - - public void Initialize(string name, - string version, - string description, - string[] assemblies, - ClrVersion targetVersion, - bool isInternal) - { - this.isInternal = isInternal; - this.name = name; - this.version = version; - this.assemblies = assemblies; - this.description = description; - this.targetVersion = targetVersion; - } - - public string Name - { - get { return name; } - } - - public string Version - { - get { return version; } - } - - public string Description - { - get { return description; } - } - - public ClrVersion TargetVersion - { - get { return targetVersion; } - } - - // The package is part of the mono SDK - public bool IsCorePackage - { - get { return name == "mono"; } - } - - // The package has been registered by an add-in, and is not installed - // in the system. - public bool IsInternalPackage - { - get { return isInternal; } - } - - public string[] Assemblies - { - get { return assemblies; } - } - - } - - - /// - /// - /// - [Target("autotools")] - public class AutotoolsTarget : ITarget - { - #region Fields - - Kernel m_Kernel; - XmlDocument autotoolsDoc; - XmlUrlResolver xr; - System.Security.Policy.Evidence e; - Hashtable assemblyPathToPackage = new Hashtable(); - Hashtable assemblyFullNameToPath = new Hashtable(); - Hashtable packagesHash = new Hashtable(); - ArrayList packages = new ArrayList(); - ClrVersion currentVersion; - - #endregion - - #region Private Methods - - private void mkdirDashP(string dirName) - { - DirectoryInfo di = new DirectoryInfo(dirName); - if (di.Exists) - return; - - string parentDirName = System.IO.Path.GetDirectoryName(dirName); - DirectoryInfo parentDi = new DirectoryInfo(parentDirName); - if (!parentDi.Exists) - mkdirDashP(parentDirName); - - di.Create(); - } - - private void mkStubFiles(string dirName, ArrayList fileNames) - { - for (int i = 0; i < fileNames.Count; i++) - { - string tmpFile = dirName + "/" + (string)fileNames[i]; - - FileStream tmpFileStream = - new FileStream(tmpFile, FileMode.Create); - - StreamWriter sw = new StreamWriter(tmpFileStream); - sw.WriteLine("These are not the files you are looking for."); - sw.Flush(); - tmpFileStream.Close(); - } - } - - private void chkMkDir(string dirName) - { - System.IO.DirectoryInfo di = - new System.IO.DirectoryInfo(dirName); - - if (!di.Exists) - di.Create(); - } - - private void transformToFile(string filename, XsltArgumentList argList, string nodeName) - { - // Create an XslTransform for this file - XslTransform templateTransformer = - new XslTransform(); - - // Load up the template - XmlNode templateNode = - autotoolsDoc.SelectSingleNode(nodeName + "/*"); - templateTransformer.Load(templateNode.CreateNavigator(), xr, e); - - // Create a writer for the transformed template - XmlTextWriter templateWriter = - new XmlTextWriter(filename, null); - - // Perform transformation, writing the file - templateTransformer.Transform - (m_Kernel.CurrentDoc, argList, templateWriter, xr); - } - - string NormalizeAsmName(string name) - { - int i = name.IndexOf(", PublicKeyToken=null"); - if (i != -1) - return name.Substring(0, i).Trim(); - else - return name; - } - - private void AddAssembly(string assemblyfile, SystemPackage package) - { - if (!File.Exists(assemblyfile)) - return; - - try - { - System.Reflection.AssemblyName an = System.Reflection.AssemblyName.GetAssemblyName(assemblyfile); - assemblyFullNameToPath[NormalizeAsmName(an.FullName)] = assemblyfile; - assemblyPathToPackage[assemblyfile] = package; - } - catch - { - } - } - - private ArrayList GetAssembliesWithLibInfo(string line, string file) - { - ArrayList references = new ArrayList(); - ArrayList libdirs = new ArrayList(); - ArrayList retval = new ArrayList(); - foreach (string piece in line.Split(' ')) - { - if (piece.ToLower().Trim().StartsWith("/r:") || piece.ToLower().Trim().StartsWith("-r:")) - { - references.Add(ProcessPiece(piece.Substring(3).Trim(), file)); - } - else if (piece.ToLower().Trim().StartsWith("/lib:") || piece.ToLower().Trim().StartsWith("-lib:")) - { - libdirs.Add(ProcessPiece(piece.Substring(5).Trim(), file)); - } - } - - foreach (string refrnc in references) - { - foreach (string libdir in libdirs) - { - if (File.Exists(libdir + Path.DirectorySeparatorChar + refrnc)) - { - retval.Add(libdir + Path.DirectorySeparatorChar + refrnc); - } - } - } - - return retval; - } - - private ArrayList GetAssembliesWithoutLibInfo(string line, string file) - { - ArrayList references = new ArrayList(); - foreach (string reference in line.Split(' ')) - { - if (reference.ToLower().Trim().StartsWith("/r:") || reference.ToLower().Trim().StartsWith("-r:")) - { - string final_ref = reference.Substring(3).Trim(); - references.Add(ProcessPiece(final_ref, file)); - } - } - return references; - } - - private string ProcessPiece(string piece, string pcfile) - { - int start = piece.IndexOf("${"); - if (start == -1) - return piece; - - int end = piece.IndexOf("}"); - if (end == -1) - return piece; - - string variable = piece.Substring(start + 2, end - start - 2); - string interp = GetVariableFromPkgConfig(variable, Path.GetFileNameWithoutExtension(pcfile)); - return ProcessPiece(piece.Replace("${" + variable + "}", interp), pcfile); - } - - private string GetVariableFromPkgConfig(string var, string pcfile) - { - ProcessStartInfo psi = new ProcessStartInfo("pkg-config"); - psi.RedirectStandardOutput = true; - psi.UseShellExecute = false; - psi.Arguments = String.Format("--variable={0} {1}", var, pcfile); - Process p = new Process(); - p.StartInfo = psi; - p.Start(); - string ret = p.StandardOutput.ReadToEnd().Trim(); - p.WaitForExit(); - if (String.IsNullOrEmpty(ret)) - return String.Empty; - return ret; - } - - private void ParsePCFile(string pcfile) - { - // Don't register the package twice - string pname = Path.GetFileNameWithoutExtension(pcfile); - if (packagesHash.Contains(pname)) - return; - - ArrayList fullassemblies = null; - string version = ""; - string desc = ""; - - SystemPackage package = new SystemPackage(); - - using (StreamReader reader = new StreamReader(pcfile)) - { - string line; - while ((line = reader.ReadLine()) != null) - { - string lowerLine = line.ToLower(); - if (lowerLine.StartsWith("libs:") && lowerLine.IndexOf(".dll") != -1) - { - string choppedLine = line.Substring(5).Trim(); - if (choppedLine.IndexOf("-lib:") != -1 || choppedLine.IndexOf("/lib:") != -1) - { - fullassemblies = GetAssembliesWithLibInfo(choppedLine, pcfile); - } - else - { - fullassemblies = GetAssembliesWithoutLibInfo(choppedLine, pcfile); - } - } - else if (lowerLine.StartsWith("version:")) - { - // "version:".Length == 8 - version = line.Substring(8).Trim(); - } - else if (lowerLine.StartsWith("description:")) - { - // "description:".Length == 12 - desc = line.Substring(12).Trim(); - } - } - } - - if (fullassemblies == null) - return; - - foreach (string assembly in fullassemblies) - { - AddAssembly(assembly, package); - } - - package.Initialize(pname, - version, - desc, - (string[])fullassemblies.ToArray(typeof(string)), - ClrVersion.Default, - false); - packages.Add(package); - packagesHash[pname] = package; - } - - void RegisterSystemAssemblies(string prefix, string version, ClrVersion ver) - { - SystemPackage package = new SystemPackage(); - ArrayList list = new ArrayList(); - - string dir = Path.Combine(prefix, version); - if (!Directory.Exists(dir)) - { - return; - } - - foreach (string assembly in Directory.GetFiles(dir, "*.dll")) - { - AddAssembly(assembly, package); - list.Add(assembly); - } - - package.Initialize("mono", - version, - "The Mono runtime", - (string[])list.ToArray(typeof(string)), - ver, - false); - packages.Add(package); - } - - void RunInitialization() - { - string versionDir; - - if (Environment.Version.Major == 1) - { - versionDir = "1.0"; - currentVersion = ClrVersion.Net_1_1; - } - else - { - versionDir = "2.0"; - currentVersion = ClrVersion.Net_2_0; - } - - //Pull up assemblies from the installed mono system. - string prefix = Path.GetDirectoryName(typeof(int).Assembly.Location); - - if (prefix.IndexOf(Path.Combine("mono", versionDir)) == -1) - prefix = Path.Combine(prefix, "mono"); - else - prefix = Path.GetDirectoryName(prefix); - - RegisterSystemAssemblies(prefix, "1.0", ClrVersion.Net_1_1); - RegisterSystemAssemblies(prefix, "2.0", ClrVersion.Net_2_0); - - string search_dirs = Environment.GetEnvironmentVariable("PKG_CONFIG_PATH"); - string libpath = Environment.GetEnvironmentVariable("PKG_CONFIG_LIBPATH"); - - if (String.IsNullOrEmpty(libpath)) - { - string path_dirs = Environment.GetEnvironmentVariable("PATH"); - foreach (string pathdir in path_dirs.Split(Path.PathSeparator)) - { - if (pathdir == null) - continue; - if (File.Exists(pathdir + Path.DirectorySeparatorChar + "pkg-config")) - { - libpath = Path.Combine(pathdir, ".."); - libpath = Path.Combine(libpath, "lib"); - libpath = Path.Combine(libpath, "pkgconfig"); - break; - } - } - } - search_dirs += Path.PathSeparator + libpath; - if (search_dirs != null && search_dirs.Length > 0) - { - ArrayList scanDirs = new ArrayList(); - foreach (string potentialDir in search_dirs.Split(Path.PathSeparator)) - { - if (!scanDirs.Contains(potentialDir)) - scanDirs.Add(potentialDir); - } - foreach (string pcdir in scanDirs) - { - if (pcdir == null) - continue; - - if (Directory.Exists(pcdir)) - { - foreach (string pcfile in Directory.GetFiles(pcdir, "*.pc")) - { - ParsePCFile(pcfile); - } - } - } - } - } - - private void WriteCombine(SolutionNode solution) - { - #region "Create Solution directory if it doesn't exist" - string solutionDir = Path.Combine(solution.FullPath, - Path.Combine("autotools", - solution.Name)); - chkMkDir(solutionDir); - #endregion - - #region "Write Solution-level files" - XsltArgumentList argList = new XsltArgumentList(); - argList.AddParam("solutionName", "", solution.Name); - // $solutionDir is $rootDir/$solutionName/ - transformToFile(Path.Combine(solutionDir, "configure.ac"), - argList, "/Autotools/SolutionConfigureAc"); - transformToFile(Path.Combine(solutionDir, "Makefile.am"), - argList, "/Autotools/SolutionMakefileAm"); - transformToFile(Path.Combine(solutionDir, "autogen.sh"), - argList, "/Autotools/SolutionAutogenSh"); - #endregion - - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - m_Kernel.Log.Write(String.Format("Writing project: {0}", - project.Name)); - WriteProject(solution, project); - } - } - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - if (match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - { - tmpPath = Helper.NormalizePath(tmpPath); - } - else - { - tmpPath = Helper.NormalizePath("./" + tmpPath); - } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, - ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = - (ProjectNode)solution.ProjectsTable[refr.Name]; - string fileRef = FindFileReference(refr.Name, project); - string finalPath = - Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + - "/$(BUILD_DIR)/$(CONFIG)/", - refr.Name, "dll"), - '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if (refr.Path != null || fileRef != null) - { - string finalPath = ((refr.Path != null) ? - Helper.NormalizePath(refr.Path + "/" + - refr.Name + ".dll", - '/') : - fileRef - ); - ret += Path.Combine(project.Path, finalPath); - return ret; - } - - try - { - //Assembly assem = Assembly.Load(refr.Name); - //if (assem != null) - //{ - // int index = refr.Name.IndexOf(","); - // if ( index > 0) - // { - // ret += assem.Location; - // //Console.WriteLine("Location1: " + assem.Location); - // } - // else - // { - // ret += (refr.Name + ".dll"); - // //Console.WriteLine("Location2: " + assem.Location); - // } - //} - //else - //{ - int index = refr.Name.IndexOf(","); - if (index > 0) - { - ret += refr.Name.Substring(0, index) + ".dll"; - //Console.WriteLine("Location3: " + assem.Location); - } - else - { - ret += (refr.Name + ".dll"); - //Console.WriteLine("Location4: " + assem.Location); - } - //} - } - catch (System.NullReferenceException e) - { - e.ToString(); - int index = refr.Name.IndexOf(","); - if (index > 0) - { - ret += refr.Name.Substring(0, index) + ".dll"; - //Console.WriteLine("Location5: " + assem.Location); - } - else - { - ret += (refr.Name + ".dll"); - //Console.WriteLine("Location6: " + assem.Location); - } - } - } - return ret; - } - - private static string BuildReferencePath(SolutionNode solution, - ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = - (ProjectNode)solution.ProjectsTable[refr.Name]; - string finalPath = - Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + - "/${build.dir}/"), - '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if (refr.Path != null || fileRef != null) - { - string finalPath = ((refr.Path != null) ? - Helper.NormalizePath(refr.Path, '/') : - fileRef - ); - ret += finalPath; - return ret; - } - - try - { - Assembly assem = Assembly.Load(refr.Name); - if (assem != null) - { - ret += ""; - } - else - { - ret += ""; - } - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += ""; - } - } - return ret; - } - - private static string FindFileReference(string refName, - ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = - Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if (File.Exists(fullPath)) { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if (conf == null) - { - throw new ArgumentNullException("conf"); - } - if (project == null) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - // { - // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - // } - return docFile; - } - - /// - /// Normalizes the path. - /// - /// The path. - /// - public static string NormalizePath(string path) - { - if (path == null) - { - return ""; - } - - StringBuilder tmpPath; - - if (Core.Parse.Preprocessor.GetOS() == "Win32") - { - tmpPath = new StringBuilder(path.Replace('\\', '/')); - tmpPath.Replace("/", @"\\"); - } - else - { - tmpPath = new StringBuilder(path.Replace('\\', '/')); - tmpPath = tmpPath.Replace('/', Path.DirectorySeparatorChar); - } - return tmpPath.ToString(); - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string solutionDir = Path.Combine(solution.FullPath, Path.Combine("autotools", solution.Name)); - string projectDir = Path.Combine(solutionDir, project.Name); - string projectVersion = project.Version; - bool hasAssemblyConfig = false; - chkMkDir(projectDir); - - ArrayList - compiledFiles = new ArrayList(), - contentFiles = new ArrayList(), - embeddedFiles = new ArrayList(), - - binaryLibs = new ArrayList(), - pkgLibs = new ArrayList(), - systemLibs = new ArrayList(), - runtimeLibs = new ArrayList(), - - extraDistFiles = new ArrayList(), - localCopyTargets = new ArrayList(); - - // If there exists a .config file for this assembly, copy - // it to the project folder - - // TODO: Support copying .config.osx files - // TODO: support processing the .config file for native library deps - string projectAssemblyName = project.Name; - if (project.AssemblyName != null) - projectAssemblyName = project.AssemblyName; - - if (File.Exists(Path.Combine(project.FullPath, projectAssemblyName) + ".dll.config")) - { - hasAssemblyConfig = true; - System.IO.File.Copy(Path.Combine(project.FullPath, projectAssemblyName + ".dll.config"), Path.Combine(projectDir, projectAssemblyName + ".dll.config"), true); - extraDistFiles.Add(project.AssemblyName + ".dll.config"); - } - - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != string.Empty) - { - // Copy snk file into the project's directory - // Use the snk from the project directory directly - string source = Path.Combine(project.FullPath, conf.Options.KeyFile); - string keyFile = conf.Options.KeyFile; - Regex re = new Regex(".*/"); - keyFile = re.Replace(keyFile, ""); - - string dest = Path.Combine(projectDir, keyFile); - // Tell the user if there's a problem copying the file - try - { - mkdirDashP(System.IO.Path.GetDirectoryName(dest)); - System.IO.File.Copy(source, dest, true); - } - catch (System.IO.IOException e) - { - Console.WriteLine(e.Message); - } - } - } - - // Copy compiled, embedded and content files into the project's directory - foreach (string filename in project.Files) - { - string source = Path.Combine(project.FullPath, filename); - string dest = Path.Combine(projectDir, filename); - - if (filename.Contains("AssemblyInfo.cs")) - { - // If we've got an AssemblyInfo.cs, pull the version number from it - string[] sources = { source }; - string[] args = { "" }; - Microsoft.CSharp.CSharpCodeProvider cscp = - new Microsoft.CSharp.CSharpCodeProvider(); - - string tempAssemblyFile = Path.Combine(Path.GetTempPath(), project.Name + "-temp.dll"); - System.CodeDom.Compiler.CompilerParameters cparam = - new System.CodeDom.Compiler.CompilerParameters(args, tempAssemblyFile); - - System.CodeDom.Compiler.CompilerResults cr = - cscp.CompileAssemblyFromFile(cparam, sources); - - foreach (System.CodeDom.Compiler.CompilerError error in cr.Errors) - Console.WriteLine("Error! '{0}'", error.ErrorText); - - try { - string projectFullName = cr.CompiledAssembly.FullName; - Regex verRegex = new Regex("Version=([\\d\\.]+)"); - Match verMatch = verRegex.Match(projectFullName); - if (verMatch.Success) - projectVersion = verMatch.Groups[1].Value; - }catch{ - Console.WriteLine("Couldn't compile AssemblyInfo.cs"); - } - - // Clean up the temp file - try - { - if (File.Exists(tempAssemblyFile)) - File.Delete(tempAssemblyFile); - } - catch - { - Console.WriteLine("Error! '{0}'", e.ToString()); - } - - } - - // Tell the user if there's a problem copying the file - try - { - mkdirDashP(System.IO.Path.GetDirectoryName(dest)); - System.IO.File.Copy(source, dest, true); - } - catch (System.IO.IOException e) - { - Console.WriteLine(e.Message); - } - - switch (project.Files.GetBuildAction(filename)) - { - case BuildAction.Compile: - compiledFiles.Add(filename); - break; - case BuildAction.Content: - contentFiles.Add(filename); - extraDistFiles.Add(filename); - break; - case BuildAction.EmbeddedResource: - embeddedFiles.Add(filename); - break; - } - } - - // Set up references - for (int refNum = 0; refNum < project.References.Count; refNum++) - { - ReferenceNode refr = (ReferenceNode)project.References[refNum]; - Assembly refAssembly = Assembly.LoadWithPartialName(refr.Name); - - /* Determine which pkg-config (.pc) file refers to - this assembly */ - - SystemPackage package = null; - - if (packagesHash.Contains(refr.Name)){ - package = (SystemPackage)packagesHash[refr.Name]; - - }else{ - string assemblyFullName = string.Empty; - if (refAssembly != null) - assemblyFullName = refAssembly.FullName; - - string assemblyFileName = string.Empty; - if (assemblyFullName != string.Empty && - assemblyFullNameToPath.Contains(assemblyFullName) - ) - assemblyFileName = - (string)assemblyFullNameToPath[assemblyFullName]; - - if (assemblyFileName != string.Empty && - assemblyPathToPackage.Contains(assemblyFileName) - ) - package = (SystemPackage)assemblyPathToPackage[assemblyFileName]; - - } - - /* If we know the .pc file and it is not "mono" - (already in the path), add a -pkg: argument */ - - if (package != null && - package.Name != "mono" && - !pkgLibs.Contains(package.Name) - ) - pkgLibs.Add(package.Name); - - string fileRef = - FindFileReference(refr.Name, (ProjectNode)refr.Parent); - - if (refr.LocalCopy || - solution.ProjectsTable.ContainsKey(refr.Name) || - fileRef != null || - refr.Path != null - ) - { - - /* Attempt to copy the referenced lib to the - project's directory */ - - string filename = refr.Name + ".dll"; - string source = filename; - if (refr.Path != null) - source = Path.Combine(refr.Path, source); - source = Path.Combine(project.FullPath, source); - string dest = Path.Combine(projectDir, filename); - - /* Since we depend on this binary dll to build, we - * will add a compile- time dependency on the - * copied dll, and add the dll to the list of - * files distributed with this package - */ - - binaryLibs.Add(refr.Name + ".dll"); - extraDistFiles.Add(refr.Name + ".dll"); - - // TODO: Support copying .config.osx files - // TODO: Support for determining native dependencies - if (File.Exists(source + ".config")) - { - System.IO.File.Copy(source + ".config", Path.GetDirectoryName(dest), true); - extraDistFiles.Add(refr.Name + ".dll.config"); - } - - try - { - System.IO.File.Copy(source, dest, true); - } - catch (System.IO.IOException) - { - if (solution.ProjectsTable.ContainsKey(refr.Name)){ - - /* If an assembly is referenced, marked for - * local copy, in the list of projects for - * this solution, but does not exist, put a - * target into the Makefile.am to build the - * assembly and copy it to this project's - * directory - */ - - ProjectNode sourcePrj = - ((ProjectNode)(solution.ProjectsTable[refr.Name])); - - string target = - String.Format("{0}:\n" + - "\t$(MAKE) -C ../{1}\n" + - "\tln ../{2}/$@ $@\n", - filename, - sourcePrj.Name, - sourcePrj.Name ); - - localCopyTargets.Add(target); - } - } - } - else if( !pkgLibs.Contains(refr.Name) ) - { - // Else, let's assume it's in the GAC or the lib path - string assemName = string.Empty; - int index = refr.Name.IndexOf(","); - - if (index > 0) - assemName = refr.Name.Substring(0, index); - else - assemName = refr.Name; - - m_Kernel.Log.Write(String.Format( - "Warning: Couldn't find an appropriate assembly " + - "for reference:\n'{0}'", refr.Name - )); - systemLibs.Add(assemName); - } - } - - string lineSep = " \\\n\t"; - string compiledFilesString = string.Empty; - if (compiledFiles.Count > 0) - compiledFilesString = - lineSep + string.Join(lineSep, (string[])compiledFiles.ToArray(typeof(string))); - - string embeddedFilesString = ""; - if (embeddedFiles.Count > 0) - embeddedFilesString = - lineSep + string.Join(lineSep, (string[])embeddedFiles.ToArray(typeof(string))); - - string contentFilesString = ""; - if (contentFiles.Count > 0) - contentFilesString = - lineSep + string.Join(lineSep, (string[])contentFiles.ToArray(typeof(string))); - - string extraDistFilesString = ""; - if (extraDistFiles.Count > 0) - extraDistFilesString = - lineSep + string.Join(lineSep, (string[])extraDistFiles.ToArray(typeof(string))); - - string pkgLibsString = ""; - if (pkgLibs.Count > 0) - pkgLibsString = - lineSep + string.Join(lineSep, (string[])pkgLibs.ToArray(typeof(string))); - - string binaryLibsString = ""; - if (binaryLibs.Count > 0) - binaryLibsString = - lineSep + string.Join(lineSep, (string[])binaryLibs.ToArray(typeof(string))); - - string systemLibsString = ""; - if (systemLibs.Count > 0) - systemLibsString = - lineSep + string.Join(lineSep, (string[])systemLibs.ToArray(typeof(string))); - - string localCopyTargetsString = ""; - if (localCopyTargets.Count > 0) - localCopyTargetsString = - string.Join("\n", (string[])localCopyTargets.ToArray(typeof(string))); - - string monoPath = ""; - foreach (string runtimeLib in runtimeLibs) - { - monoPath += ":`pkg-config --variable=libdir " + runtimeLib + "`"; - } - - // Add the project name to the list of transformation - // parameters - XsltArgumentList argList = new XsltArgumentList(); - argList.AddParam("projectName", "", project.Name); - argList.AddParam("solutionName", "", solution.Name); - argList.AddParam("assemblyName", "", projectAssemblyName); - argList.AddParam("compiledFiles", "", compiledFilesString); - argList.AddParam("embeddedFiles", "", embeddedFilesString); - argList.AddParam("contentFiles", "", contentFilesString); - argList.AddParam("extraDistFiles", "", extraDistFilesString); - argList.AddParam("pkgLibs", "", pkgLibsString); - argList.AddParam("binaryLibs", "", binaryLibsString); - argList.AddParam("systemLibs", "", systemLibsString); - argList.AddParam("monoPath", "", monoPath); - argList.AddParam("localCopyTargets", "", localCopyTargetsString); - argList.AddParam("projectVersion", "", projectVersion); - argList.AddParam("hasAssemblyConfig", "", hasAssemblyConfig ? "true" : ""); - - // Transform the templates - transformToFile(Path.Combine(projectDir, "configure.ac"), argList, "/Autotools/ProjectConfigureAc"); - transformToFile(Path.Combine(projectDir, "Makefile.am"), argList, "/Autotools/ProjectMakefileAm"); - transformToFile(Path.Combine(projectDir, "autogen.sh"), argList, "/Autotools/ProjectAutogenSh"); - - if (project.Type == Core.Nodes.ProjectType.Library) - transformToFile(Path.Combine(projectDir, project.Name + ".pc.in"), argList, "/Autotools/ProjectPcIn"); - if (project.Type == Core.Nodes.ProjectType.Exe || project.Type == Core.Nodes.ProjectType.WinExe) - transformToFile(Path.Combine(projectDir, project.Name.ToLower() + ".in"), argList, "/Autotools/ProjectWrapperScriptIn"); - } - - private void WriteProjectOld(SolutionNode solution, ProjectNode project) - { - string projFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); - StreamWriter ss = new StreamWriter(projFile); - ss.NewLine = "\n"; - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - - using (ss) - { - ss.WriteLine(Helper.AssemblyFullName(project.AssemblyName, project.Type) + ":"); - ss.WriteLine("\tmkdir -p " + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/"); - foreach (string file in project.Files) - { - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.Write("\tresgen "); - ss.Write(Helper.NormalizePath(Path.Combine(project.Path, file.Substring(0, file.LastIndexOf('.')) + ".resx "), '/')); - if (project.Files.GetResourceName(file) != "") - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/')); - } - else - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/')); - } - } - } - ss.WriteLine("\t$(CSC)\t/out:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " \\"); - ss.WriteLine("\t\t/target:" + project.Type.ToString().ToLower() + " \\"); - if (project.References.Count > 0) - { - ss.Write("\t\t/reference:"); - bool firstref = true; - foreach (ReferenceNode refr in project.References) - { - if (firstref) - { - firstref = false; - } - else - { - ss.Write(","); - } - ss.Write("{0}", Helper.NormalizePath(Helper.MakePathRelativeTo(solution.FullPath, BuildReference(solution, refr)), '/')); - } - ss.WriteLine(" \\"); - } - //ss.WriteLine("\t\tProperties/AssemblyInfo.cs \\"); - - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.EmbeddedResource: - ss.Write("\t\t/resource:"); - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, file), '/') + " \\"); - break; - default: - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.Write("\t\t/resource:"); - if (project.Files.GetResourceName(file) != "") - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources"), '/') + "," + project.RootNamespace + "." + project.Files.GetResourceName(file) + ".resources" + " \\"); - } - else - { - ss.WriteLine(Helper.NormalizePath(Path.Combine(project.Path, project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources"), '/') + "," + project.RootNamespace + "." + file.Substring(0, file.LastIndexOf('.')) + ".resources" + " \\"); - } - } - break; - } - } - - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != "") - { - ss.WriteLine("\t\t/keyfile:" + Helper.NormalizePath(Path.Combine(project.Path, conf.Options.KeyFile), '/') + " \\"); - break; - } - } - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.AllowUnsafe) - { - ss.WriteLine("\t\t/unsafe \\"); - break; - } - } - if (project.AppIcon != "") - { - ss.WriteLine("\t\t/win32icon:" + Helper.NormalizePath(Path.Combine(project.Path, project.AppIcon), '/') + " \\"); - } - - foreach (ConfigurationNode conf in project.Configurations) - { - ss.WriteLine("\t\t/define:{0}", conf.Options.CompilerDefines.Replace(';', ',') + " \\"); - break; - } - - foreach (ConfigurationNode conf in project.Configurations) - { - if (GetXmlDocFile(project, conf) != "") - { - ss.WriteLine("\t\t/doc:" + Helper.MakePathRelativeTo(solution.FullPath, project.Path) + "/$(BUILD_DIR)/$(CONFIG)/" + project.Name + ".xml \\"); - break; - } - } - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.Compile: - ss.WriteLine("\t\t\\"); - ss.Write("\t\t" + NormalizePath(Path.Combine(Helper.MakePathRelativeTo(solution.FullPath, project.Path), file))); - break; - default: - break; - } - } - ss.WriteLine(); - ss.WriteLine(); - - if (project.Type == ProjectType.Library) - { - ss.WriteLine("install-data-local:"); - ss.WriteLine(" echo \"$(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS)\"; \\"); - ss.WriteLine(" $(GACUTIL) /i bin/Release/" + project.Name + ".dll /f $(GACUTIL_FLAGS) || exit 1;"); - ss.WriteLine(); - ss.WriteLine("uninstall-local:"); - ss.WriteLine(" echo \"$(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS)\"; \\"); - ss.WriteLine(" $(GACUTIL) /u " + project.Name + " $(GACUTIL_FLAGS) || exit 1;"); - ss.WriteLine(); - } - ss.WriteLine("CLEANFILES = $(BUILD_DIR)/$(CONFIG)/" + Helper.AssemblyFullName(project.AssemblyName, project.Type) + " $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".mdb $(BUILD_DIR)/$(CONFIG)/" + project.AssemblyName + ".pdb " + project.AssemblyName + ".xml"); - ss.WriteLine("EXTRA_DIST = \\"); - ss.Write(" $(FILES)"); - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != "") - { - ss.Write(" \\"); - ss.WriteLine("\t" + conf.Options.KeyFile); - } - break; - } - } - m_Kernel.CurrentWorkingDirectory.Pop(); - } - bool hasLibrary = false; - - private void WriteCombineOld(SolutionNode solution) - { - - /* TODO: These vars should be pulled from the prebuild.xml file */ - string releaseVersion = "2.0.0"; - string assemblyVersion = "2.1.0.0"; - string description = - "Tao Framework " + solution.Name + " Binding For .NET"; - - hasLibrary = false; - m_Kernel.Log.Write("Creating Autotools make files"); - foreach (ProjectNode project in solution.Projects) - { - if (m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating makefile: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); - StreamWriter ss = new StreamWriter(combFile); - ss.NewLine = "\n"; - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using (ss) - { - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - hasLibrary = true; - break; - } - } - - if (hasLibrary) - { - ss.Write("pkgconfig_in_files = "); - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - string combFilepc = Helper.MakeFilePath(solution.FullPath, project.Name, "pc.in"); - ss.Write(" " + project.Name + ".pc.in "); - StreamWriter sspc = new StreamWriter(combFilepc); - sspc.NewLine = "\n"; - using (sspc) - { - sspc.WriteLine("prefix=@prefix@"); - sspc.WriteLine("exec_prefix=${prefix}"); - sspc.WriteLine("libdir=${exec_prefix}/lib"); - sspc.WriteLine(); - sspc.WriteLine("Name: @PACKAGE_NAME@"); - sspc.WriteLine("Description: @DESCRIPTION@"); - sspc.WriteLine("Version: @ASSEMBLY_VERSION@"); - sspc.WriteLine("Libs: -r:${libdir}/mono/gac/@PACKAGE_NAME@/@ASSEMBLY_VERSION@__@PUBKEY@/@PACKAGE_NAME@.dll"); - } - } - } - - ss.WriteLine(); - ss.WriteLine("pkgconfigdir=$(prefix)/lib/pkgconfig"); - ss.WriteLine("pkgconfig_DATA=$(pkgconfig_in_files:.pc.in=.pc)"); - } - ss.WriteLine(); - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine("-include x {0}", - Helper.NormalizePath(Helper.MakeFilePath(path, "Include", "am"), '/')); - } - ss.WriteLine(); - ss.WriteLine("all: \\"); - ss.Write("\t"); - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(Helper.AssemblyFullName(project.AssemblyName, project.Type) + " "); - - } - ss.WriteLine(); - if (hasLibrary) - { - ss.WriteLine("EXTRA_DIST = \\"); - ss.WriteLine("\t$(pkgconfig_in_files)"); - } - else - { - ss.WriteLine("EXTRA_DIST = "); - } - ss.WriteLine(); - ss.WriteLine("DISTCLEANFILES = \\"); - ss.WriteLine("\tconfigure \\"); - ss.WriteLine("\tMakefile.in \\"); - ss.WriteLine("\taclocal.m4"); - } - combFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); - StreamWriter ts = new StreamWriter(combFile); - ts.NewLine = "\n"; - using (ts) - { - if (this.hasLibrary) - { - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - ts.WriteLine("AC_INIT(" + project.Name + ".pc.in)"); - break; - } - } - } - else - { - ts.WriteLine("AC_INIT(Makefile.am)"); - } - ts.WriteLine("AC_PREREQ(2.53)"); - ts.WriteLine("AC_CANONICAL_SYSTEM"); - - ts.WriteLine("PACKAGE_NAME={0}", solution.Name); - ts.WriteLine("PACKAGE_VERSION={0}", releaseVersion); - ts.WriteLine("DESCRIPTION=\"{0}\"", description); - ts.WriteLine("AC_SUBST(DESCRIPTION)"); - ts.WriteLine("AM_INIT_AUTOMAKE([$PACKAGE_NAME],[$PACKAGE_VERSION],[$DESCRIPTION])"); - - ts.WriteLine("ASSEMBLY_VERSION={0}", assemblyVersion); - ts.WriteLine("AC_SUBST(ASSEMBLY_VERSION)"); - - ts.WriteLine("PUBKEY=`sn -t $PACKAGE_NAME.snk | grep 'Public Key Token' | awk -F: '{print $2}' | sed -e 's/^ //'`"); - ts.WriteLine("AC_SUBST(PUBKEY)"); - - ts.WriteLine(); - ts.WriteLine("AM_MAINTAINER_MODE"); - ts.WriteLine(); - ts.WriteLine("dnl AC_PROG_INTLTOOL([0.25])"); - ts.WriteLine(); - ts.WriteLine("AC_PROG_INSTALL"); - ts.WriteLine(); - ts.WriteLine("MONO_REQUIRED_VERSION=1.1"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_CHECKING([whether we're compiling from CVS])"); - ts.WriteLine("if test -f \"$srcdir/.cvs_version\" ; then"); - ts.WriteLine(" from_cvs=yes"); - ts.WriteLine("else"); - ts.WriteLine(" if test -f \"$srcdir/.svn\" ; then"); - ts.WriteLine(" from_cvs=yes"); - ts.WriteLine(" else"); - ts.WriteLine(" from_cvs=no"); - ts.WriteLine(" fi"); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_RESULT($from_cvs)"); - ts.WriteLine(); - ts.WriteLine("AC_PATH_PROG(MONO, mono)"); - ts.WriteLine("AC_PATH_PROG(GMCS, gmcs)"); - ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil)"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_CHECKING([for mono])"); - ts.WriteLine("dnl if test \"x$MONO\" = \"x\" ; then"); - ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"mono\" in your PATH])"); - ts.WriteLine("dnl else"); - ts.WriteLine(" AC_MSG_RESULT([found])"); - ts.WriteLine("dnl fi"); - ts.WriteLine(); - ts.WriteLine("AC_MSG_CHECKING([for gmcs])"); - ts.WriteLine("dnl if test \"x$GMCS\" = \"x\" ; then"); - ts.WriteLine("dnl AC_MSG_ERROR([Can't find \"gmcs\" in your PATH])"); - ts.WriteLine("dnl else"); - ts.WriteLine(" AC_MSG_RESULT([found])"); - ts.WriteLine("dnl fi"); - ts.WriteLine(); - //ts.WriteLine("AC_MSG_CHECKING([for gacutil])"); - //ts.WriteLine("if test \"x$GACUTIL\" = \"x\" ; then"); - //ts.WriteLine(" AC_MSG_ERROR([Can't find \"gacutil\" in your PATH])"); - //ts.WriteLine("else"); - //ts.WriteLine(" AC_MSG_RESULT([found])"); - //ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(PATH)"); - ts.WriteLine("AC_SUBST(LD_LIBRARY_PATH)"); - ts.WriteLine(); - ts.WriteLine("dnl CSFLAGS=\"-debug -nowarn:1574\""); - ts.WriteLine("CSFLAGS=\"\""); - ts.WriteLine("AC_SUBST(CSFLAGS)"); - ts.WriteLine(); - // ts.WriteLine("AC_MSG_CHECKING(--disable-sdl argument)"); - // ts.WriteLine("AC_ARG_ENABLE(sdl,"); - // ts.WriteLine(" [ --disable-sdl Disable Sdl interface.],"); - // ts.WriteLine(" [disable_sdl=$disableval],"); - // ts.WriteLine(" [disable_sdl=\"no\"])"); - // ts.WriteLine("AC_MSG_RESULT($disable_sdl)"); - // ts.WriteLine("if test \"$disable_sdl\" = \"yes\"; then"); - // ts.WriteLine(" AC_DEFINE(FEAT_SDL)"); - // ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("dnl Find pkg-config"); - ts.WriteLine("AC_PATH_PROG(PKGCONFIG, pkg-config, no)"); - ts.WriteLine("if test \"x$PKG_CONFIG\" = \"xno\"; then"); - ts.WriteLine(" AC_MSG_ERROR([You need to install pkg-config])"); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false)"); - ts.WriteLine("BUILD_DIR=\"bin\""); - ts.WriteLine("AC_SUBST(BUILD_DIR)"); - ts.WriteLine("CONFIG=\"Release\""); - ts.WriteLine("AC_SUBST(CONFIG)"); - ts.WriteLine(); - ts.WriteLine("if test \"x$has_mono\" = \"xtrue\"; then"); - ts.WriteLine(" AC_PATH_PROG(RUNTIME, mono, no)"); - ts.WriteLine(" AC_PATH_PROG(CSC, gmcs, no)"); - ts.WriteLine(" if test `uname -s` = \"Darwin\"; then"); - ts.WriteLine(" LIB_PREFIX="); - ts.WriteLine(" LIB_SUFFIX=.dylib"); - ts.WriteLine(" else"); - ts.WriteLine(" LIB_PREFIX=.so"); - ts.WriteLine(" LIB_SUFFIX="); - ts.WriteLine(" fi"); - ts.WriteLine("else"); - ts.WriteLine(" AC_PATH_PROG(CSC, csc.exe, no)"); - ts.WriteLine(" if test x$CSC = \"xno\"; then"); - ts.WriteLine(" AC_MSG_ERROR([You need to install either mono or .Net])"); - ts.WriteLine(" else"); - ts.WriteLine(" RUNTIME="); - ts.WriteLine(" LIB_PREFIX="); - ts.WriteLine(" LIB_SUFFIX=.dylib"); - ts.WriteLine(" fi"); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(LIB_PREFIX)"); - ts.WriteLine("AC_SUBST(LIB_SUFFIX)"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_CFLAGS)"); - ts.WriteLine("AC_SUBST(BASE_DEPENDENCIES_LIBS)"); - ts.WriteLine(); - ts.WriteLine("dnl Find monodoc"); - ts.WriteLine("MONODOC_REQUIRED_VERSION=1.0"); - ts.WriteLine("AC_SUBST(MONODOC_REQUIRED_VERSION)"); - ts.WriteLine("PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no)"); - ts.WriteLine(); - ts.WriteLine("if test \"x$enable_monodoc\" = \"xyes\"; then"); - ts.WriteLine(" AC_PATH_PROG(MONODOC, monodoc, no)"); - ts.WriteLine(" if test x$MONODOC = xno; then"); - ts.WriteLine(" enable_monodoc=no"); - ts.WriteLine(" fi"); - ts.WriteLine("else"); - ts.WriteLine(" MONODOC="); - ts.WriteLine("fi"); - ts.WriteLine(); - ts.WriteLine("AC_SUBST(MONODOC)"); - ts.WriteLine("AM_CONDITIONAL(ENABLE_MONODOC, test \"x$enable_monodoc\" = \"xyes\")"); - ts.WriteLine(); - ts.WriteLine("AC_PATH_PROG(GACUTIL, gacutil, no)"); - ts.WriteLine("if test \"x$GACUTIL\" = \"xno\" ; then"); - ts.WriteLine(" AC_MSG_ERROR([No gacutil tool found])"); - ts.WriteLine("fi"); - ts.WriteLine(); - // foreach(ProjectNode project in solution.ProjectsTableOrder) - // { - // if (project.Type == ProjectType.Library) - // { - // } - // } - ts.WriteLine("GACUTIL_FLAGS='/package $(PACKAGE_NAME) /gacdir $(DESTDIR)$(prefix)'"); - ts.WriteLine("AC_SUBST(GACUTIL_FLAGS)"); - ts.WriteLine(); - ts.WriteLine("winbuild=no"); - ts.WriteLine("case \"$host\" in"); - ts.WriteLine(" *-*-mingw*|*-*-cygwin*)"); - ts.WriteLine(" winbuild=yes"); - ts.WriteLine(" ;;"); - ts.WriteLine("esac"); - ts.WriteLine("AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes)"); - ts.WriteLine(); - // ts.WriteLine("dnl Check for SDL"); - // ts.WriteLine(); - // ts.WriteLine("AC_PATH_PROG([SDL_CONFIG], [sdl-config])"); - // ts.WriteLine("have_sdl=no"); - // ts.WriteLine("if test -n \"${SDL_CONFIG}\"; then"); - // ts.WriteLine(" have_sdl=yes"); - // ts.WriteLine(" SDL_CFLAGS=`$SDL_CONFIG --cflags`"); - // ts.WriteLine(" SDL_LIBS=`$SDL_CONFIG --libs`"); - // ts.WriteLine(" #"); - // ts.WriteLine(" # sdl-config sometimes emits an rpath flag pointing at its library"); - // ts.WriteLine(" # installation directory. We don't want this, as it prevents users from"); - // ts.WriteLine(" # linking sdl-viewer against, for example, a locally compiled libGL when a"); - // ts.WriteLine(" # version of the library also exists in SDL's library installation"); - // ts.WriteLine(" # directory, typically /usr/lib."); - // ts.WriteLine(" #"); - // ts.WriteLine(" SDL_LIBS=`echo $SDL_LIBS | sed 's/-Wl,-rpath,[[^ ]]* //'`"); - // ts.WriteLine("fi"); - // ts.WriteLine("AC_SUBST([SDL_CFLAGS])"); - // ts.WriteLine("AC_SUBST([SDL_LIBS])"); - ts.WriteLine(); - ts.WriteLine("AC_OUTPUT(["); - ts.WriteLine("Makefile"); - // TODO: this does not work quite right. - //ts.WriteLine("Properties/AssemblyInfo.cs"); - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.Type == ProjectType.Library) - { - ts.WriteLine(project.Name + ".pc"); - } - // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - // ts.WriteLine(Helper.NormalizePath(Helper.MakeFilePath(path, "Include"),'/')); - } - ts.WriteLine("])"); - ts.WriteLine(); - ts.WriteLine("#po/Makefile.in"); - ts.WriteLine(); - ts.WriteLine("echo \"---\""); - ts.WriteLine("echo \"Configuration summary\""); - ts.WriteLine("echo \"\""); - ts.WriteLine("echo \" * Installation prefix: $prefix\""); - ts.WriteLine("echo \" * compiler: $CSC\""); - ts.WriteLine("echo \" * Documentation: $enable_monodoc ($MONODOC)\""); - ts.WriteLine("echo \" * Package Name: $PACKAGE_NAME\""); - ts.WriteLine("echo \" * Version: $PACKAGE_VERSION\""); - ts.WriteLine("echo \" * Public Key: $PUBKEY\""); - ts.WriteLine("echo \"\""); - ts.WriteLine("echo \"---\""); - ts.WriteLine(); - } - - ts.NewLine = "\n"; - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - if (project.GenerateAssemblyInfoFile) - { - GenerateAssemblyInfoFile(solution, combFile); - } - } - } - - private static void GenerateAssemblyInfoFile(SolutionNode solution, string combFile) - { - System.IO.Directory.CreateDirectory(Helper.MakePathRelativeTo(solution.FullPath, "Properties")); - combFile = Helper.MakeFilePath(solution.FullPath + "/Properties/", "AssemblyInfo.cs", "in"); - StreamWriter ai = new StreamWriter(combFile); - - using (ai) - { - ai.WriteLine("#region License"); - ai.WriteLine("/*"); - ai.WriteLine("MIT License"); - ai.WriteLine("Copyright (c)2003-2006 Tao Framework Team"); - ai.WriteLine("http://www.taoframework.com"); - ai.WriteLine("All rights reserved."); - ai.WriteLine(""); - ai.WriteLine("Permission is hereby granted, free of charge, to any person obtaining a copy"); - ai.WriteLine("of this software and associated documentation files (the \"Software\"), to deal"); - ai.WriteLine("in the Software without restriction, including without limitation the rights"); - ai.WriteLine("to use, copy, modify, merge, publish, distribute, sublicense, and/or sell"); - ai.WriteLine("copies of the Software, and to permit persons to whom the Software is"); - ai.WriteLine("furnished to do so, subject to the following conditions:"); - ai.WriteLine(""); - ai.WriteLine("The above copyright notice and this permission notice shall be included in all"); - ai.WriteLine("copies or substantial portions of the Software."); - ai.WriteLine(""); - ai.WriteLine("THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR"); - ai.WriteLine("IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,"); - ai.WriteLine("FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE"); - ai.WriteLine("AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER"); - ai.WriteLine("LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,"); - ai.WriteLine("OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE"); - ai.WriteLine("SOFTWARE."); - ai.WriteLine("*/"); - ai.WriteLine("#endregion License"); - ai.WriteLine(""); - ai.WriteLine("using System;"); - ai.WriteLine("using System.Reflection;"); - ai.WriteLine("using System.Runtime.InteropServices;"); - ai.WriteLine("using System.Security;"); - ai.WriteLine("using System.Security.Permissions;"); - ai.WriteLine(""); - ai.WriteLine("[assembly: AllowPartiallyTrustedCallers]"); - ai.WriteLine("[assembly: AssemblyCompany(\"Tao Framework -- http://www.taoframework.com\")]"); - ai.WriteLine("[assembly: AssemblyConfiguration(\"Retail\")]"); - ai.WriteLine("[assembly: AssemblyCopyright(\"Copyright (c)2003-2006 Tao Framework Team. All rights reserved.\")]"); - ai.WriteLine("[assembly: AssemblyCulture(\"\")]"); - ai.WriteLine("[assembly: AssemblyDefaultAlias(\"@PACKAGE_NAME@\")]"); - ai.WriteLine("[assembly: AssemblyDelaySign(false)]"); - ai.WriteLine("[assembly: AssemblyDescription(\"@DESCRIPTION@\")]"); - ai.WriteLine("[assembly: AssemblyFileVersion(\"@ASSEMBLY_VERSION@\")]"); - ai.WriteLine("[assembly: AssemblyInformationalVersion(\"@ASSEMBLY_VERSION@\")]"); - ai.WriteLine("[assembly: AssemblyKeyName(\"\")]"); - ai.WriteLine("[assembly: AssemblyProduct(\"@PACKAGE_NAME@.dll\")]"); - ai.WriteLine("[assembly: AssemblyTitle(\"@DESCRIPTION@\")]"); - ai.WriteLine("[assembly: AssemblyTrademark(\"Tao Framework -- http://www.taoframework.com\")]"); - ai.WriteLine("[assembly: AssemblyVersion(\"@ASSEMBLY_VERSION@\")]"); - ai.WriteLine("[assembly: CLSCompliant(true)]"); - ai.WriteLine("[assembly: ComVisible(false)]"); - ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.Execution)]"); - ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.SkipVerification)]"); - ai.WriteLine("[assembly: SecurityPermission(SecurityAction.RequestMinimum, Flags = SecurityPermissionFlag.UnmanagedCode)]"); - - } - //return combFile; - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, "Include", "am"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning Autotools make files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "am"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile", "in"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "configure", "ac"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "configure"); - Helper.DeleteIfExists(slnFile); - - slnFile = Helper.MakeFilePath(solution.FullPath, "Makefile"); - Helper.DeleteIfExists(slnFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - m_Kernel.Log.Write("Parsing system pkg-config files"); - RunInitialization(); - - string streamName = "autotools.xml"; - string fqStreamName = String.Format("Prebuild.data.{0}", - streamName - ); - - // Retrieve stream for the autotools template XML - Stream autotoolsStream = Assembly.GetExecutingAssembly() - .GetManifestResourceStream(fqStreamName); - - if(autotoolsStream == null) { - - /* - * try without the default namespace prepended, in - * case prebuild.exe assembly was compiled with - * something other than Visual Studio .NET - */ - - autotoolsStream = Assembly.GetExecutingAssembly() - .GetManifestResourceStream(streamName); - if(autotoolsStream == null){ - string errStr = - String.Format("Could not find embedded resource file:\n" + - "'{0}' or '{1}'", - streamName, fqStreamName - ); - - m_Kernel.Log.Write(errStr); - - throw new System.Reflection.TargetException(errStr); - } - } - - // Create an XML URL Resolver with default credentials - xr = new System.Xml.XmlUrlResolver(); - xr.Credentials = CredentialCache.DefaultCredentials; - - // Create a default evidence - no need to limit access - e = new System.Security.Policy.Evidence(); - - // Load the autotools XML - autotoolsDoc = new XmlDocument(); - autotoolsDoc.Load(autotoolsStream); - - /* rootDir is the filesystem location where the Autotools - * build tree will be created - for now we'll make it - * $PWD/autotools - */ - - string pwd = Directory.GetCurrentDirectory(); - //string pwd = System.Environment.GetEnvironmentVariable("PWD"); - string rootDir = ""; - //if (pwd.Length != 0) - //{ - rootDir = Path.Combine(pwd, "autotools"); - //} - //else - //{ - // pwd = Assembly.GetExecutingAssembly() - //} - chkMkDir(rootDir); - - foreach (SolutionNode solution in kern.Solutions) - { - m_Kernel.Log.Write(String.Format("Writing solution: {0}", - solution.Name)); - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "autotools"; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/DebugTarget.cs b/Programs/Prebuild/src/Core/Targets/DebugTarget.cs deleted file mode 100644 index d73b8eac..00000000 --- a/Programs/Prebuild/src/Core/Targets/DebugTarget.cs +++ /dev/null @@ -1,102 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-09-20 00:42:51 -0700 (Wed, 20 Sep 2006) $ - * $Revision: 164 $ - */ -#endregion - -using System; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; - -#if (DEBUG && _DEBUG_TARGET) -namespace Prebuild.Core.Targets -{ - [Target("debug")] - public class DebugTarget : ITarget - { -#region Fields - - private Kernel m_Kernel = null; - -#endregion - -#region ITarget Members - - public void Write() - { - foreach(SolutionNode s in m_Kernel.Solutions) - { - Console.WriteLine("Solution [ {0}, {1} ]", s.Name, s.Path); - foreach(string file in s.Files) -{ - Console.WriteLine("\tFile [ {0} ]", file); -} - - foreach(ProjectNode proj in s.Projects) - { - Console.WriteLine("\tProject [ {0}, {1}. {2} ]", proj.Name, proj.Path, proj.Language); - foreach(string file in proj.Files) - Console.WriteLine("\t\tFile [ {0} ]", file); - } - } - } - - public void Clean() - { - Console.WriteLine("Not implemented"); - } - - public string Name - { - get - { - return "debug"; - } - } - - public Kernel Kernel - { - get - { - return m_Kernel; - } - set - { - m_Kernel = value; - } - } - -#endregion - } -} -#endif diff --git a/Programs/Prebuild/src/Core/Targets/MakefileTarget.cs b/Programs/Prebuild/src/Core/Targets/MakefileTarget.cs deleted file mode 100644 index ed4ba6bf..00000000 --- a/Programs/Prebuild/src/Core/Targets/MakefileTarget.cs +++ /dev/null @@ -1,471 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Crestez Leonard (cleonard@go.ro) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - [Target("makefile")] - public class MakefileTarget : ITarget - { - #region Fields - - private Kernel m_Kernel = null; - - #endregion - - #region Private Methods - - // This converts a path relative to the path of a project to - // a path relative to the solution path. - private string NicePath(ProjectNode proj, string path) - { - string res; - SolutionNode solution = (SolutionNode)proj.Parent; - res = Path.Combine(Helper.NormalizePath(proj.FullPath, '/'), Helper.NormalizePath(path, '/')); - res = Helper.NormalizePath(res, '/'); - res = res.Replace("/./", "/"); - while (res.IndexOf("/../") >= 0) - { - int a = res.IndexOf("/../"); - int b = res.LastIndexOf("/", a - 1); - res = res.Remove(b, a - b + 3); - } - res = Helper.MakePathRelativeTo(solution.FullPath, res); - if (res.StartsWith("./")) - res = res.Substring(2, res.Length - 2); - res = Helper.NormalizePath(res, '/'); - return res; - } - - private void WriteProjectFiles(StreamWriter f, SolutionNode solution, ProjectNode project) - { - // Write list of source code files - f.WriteLine("SOURCES_{0} = \\", project.Name); - foreach (string file in project.Files) - if (project.Files.GetBuildAction(file) == BuildAction.Compile) - f.WriteLine("\t{0} \\", NicePath(project, file)); - f.WriteLine(); - - // Write list of resource files - f.WriteLine("RESOURCES_{0} = \\", project.Name); - foreach (string file in project.Files) - if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource) - { - string path = NicePath(project, file); - f.WriteLine("\t-resource:{0},{1} \\", path, Path.GetFileName(path)); - } - f.WriteLine(); - - // There's also Content and None in BuildAction. - // What am I supposed to do with that? - } - - private string FindFileReference(string refName, ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = NicePath(project, Helper.MakeFilePath(refPath.Path, refName, "dll")); - if (File.Exists(fullPath)) - return fullPath; - } - return null; - } - - private void WriteProjectReferences(StreamWriter f, SolutionNode solution, ProjectNode project) - { - f.WriteLine("REFERENCES_{0} = \\", project.Name); - foreach (ReferenceNode refr in project.References) - { - string path; - // Project references change with configurations. - if (solution.ProjectsTable.Contains(refr.Name)) - continue; - path = FindFileReference(refr.Name, project); - if (path != null) - f.WriteLine("\t-r:{0} \\", path); - else - f.WriteLine("\t-r:{0} \\", refr.Name); - } - f.WriteLine(); - } - - private void WriteProjectDependencies(StreamWriter f, SolutionNode solution, ProjectNode project) - { - f.WriteLine("DEPENDENCIES_{0} = \\", project.Name); - f.WriteLine("\t$(SOURCES_{0}) \\", project.Name); - foreach (string file in project.Files) - if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource) - f.WriteLine("\t{0} \\", NicePath(project, file)); - f.WriteLine(); - } - - private string ProjectTypeToExtension(ProjectType t) - { - if (t == ProjectType.Exe || t == ProjectType.WinExe) - { - return "exe"; - } - else if (t == ProjectType.Library) - { - return "dll"; - } - else - { - throw new FatalException("Bad ProjectType: {0}", t); - } - } - - private string ProjectTypeToTarget(ProjectType t) - { - if (t == ProjectType.Exe) - { - return "exe"; - } - else if (t == ProjectType.WinExe) - { - return "winexe"; - } - else if (t == ProjectType.Library) - { - return "library"; - } - else - { - throw new FatalException("Bad ProjectType: {0}", t); - } - } - - private string ProjectOutput(ProjectNode project, ConfigurationNode config) - { - string filepath; - filepath = Helper.MakeFilePath((string)config.Options["OutputPath"], - project.AssemblyName, ProjectTypeToExtension(project.Type)); - return NicePath(project, filepath); - } - - // Returns true if two configs in one project have the same output. - private bool ProjectClashes(ProjectNode project) - { - foreach (ConfigurationNode conf1 in project.Configurations) - foreach (ConfigurationNode conf2 in project.Configurations) - if (ProjectOutput(project, conf1) == ProjectOutput(project, conf2) && conf1 != conf2) - { - m_Kernel.Log.Write("Warning: Configurations {0} and {1} for project {2} output the same file", - conf1.Name, conf2.Name, project.Name); - m_Kernel.Log.Write("Warning: I'm going to use some timestamps(extra empty files)."); - return true; - } - return false; - } - - private void WriteProject(StreamWriter f, SolutionNode solution, ProjectNode project) - { - f.WriteLine("# This is for project {0}", project.Name); - f.WriteLine(); - - WriteProjectFiles(f, solution, project); - WriteProjectReferences(f, solution, project); - WriteProjectDependencies(f, solution, project); - - bool clash = ProjectClashes(project); - - foreach (ConfigurationNode conf in project.Configurations) - { - string outpath = ProjectOutput(project, conf); - string filesToClean = outpath; - - if (clash) - { - f.WriteLine("{0}-{1}: .{0}-{1}-timestamp", project.Name, conf.Name); - f.WriteLine(); - f.Write(".{0}-{1}-timestamp: $(DEPENDENCIES_{0})", project.Name, conf.Name); - } - else - { - f.WriteLine("{0}-{1}: {2}", project.Name, conf.Name, outpath); - f.WriteLine(); - f.Write("{2}: $(DEPENDENCIES_{0})", project.Name, conf.Name, outpath); - } - // Dependencies on other projects. - foreach (ReferenceNode refr in project.References) - if (solution.ProjectsTable.Contains(refr.Name)) - { - ProjectNode refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; - if (ProjectClashes(refProj)) - f.Write(" .{0}-{1}-timestamp", refProj.Name, conf.Name); - else - f.Write(" {0}", ProjectOutput(refProj, conf)); - } - f.WriteLine(); - - // make directory for output. - if (Path.GetDirectoryName(outpath) != "") - { - f.WriteLine("\tmkdir -p {0}", Path.GetDirectoryName(outpath)); - } - // mcs command line. - f.Write("\tgmcs", project.Name); - f.Write(" -warn:{0}", conf.Options["WarningLevel"]); - if ((bool)conf.Options["DebugInformation"]) - f.Write(" -debug"); - if ((bool)conf.Options["AllowUnsafe"]) - f.Write(" -unsafe"); - if ((bool)conf.Options["CheckUnderflowOverflow"]) - f.Write(" -checked"); - if (project.StartupObject != "") - f.Write(" -main:{0}", project.StartupObject); - if ((string)conf.Options["CompilerDefines"] != "") - { - f.Write(" -define:\"{0}\"", conf.Options["CompilerDefines"]); - } - - f.Write(" -target:{0} -out:{1}", ProjectTypeToTarget(project.Type), outpath); - - // Build references to other projects. Now that sux. - // We have to reference the other project in the same conf. - foreach (ReferenceNode refr in project.References) - if (solution.ProjectsTable.Contains(refr.Name)) - { - ProjectNode refProj; - refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; - f.Write(" -r:{0}", ProjectOutput(refProj, conf)); - } - - f.Write(" $(REFERENCES_{0})", project.Name); - f.Write(" $(RESOURCES_{0})", project.Name); - f.Write(" $(SOURCES_{0})", project.Name); - f.WriteLine(); - - // Copy references with localcopy. - foreach (ReferenceNode refr in project.References) - if (refr.LocalCopy) - { - string outPath, srcPath, destPath; - outPath = Helper.NormalizePath((string)conf.Options["OutputPath"]); - if (solution.ProjectsTable.Contains(refr.Name)) - { - ProjectNode refProj; - refProj = (ProjectNode)solution.ProjectsTable[refr.Name]; - srcPath = ProjectOutput(refProj, conf); - destPath = Path.Combine(outPath, Path.GetFileName(srcPath)); - destPath = NicePath(project, destPath); - if (srcPath != destPath) - { - f.WriteLine("\tcp -f {0} {1}", srcPath, destPath); - filesToClean += " " + destPath; - } - continue; - } - srcPath = FindFileReference(refr.Name, project); - if (srcPath != null) - { - destPath = Path.Combine(outPath, Path.GetFileName(srcPath)); - destPath = NicePath(project, destPath); - f.WriteLine("\tcp -f {0} {1}", srcPath, destPath); - filesToClean += " " + destPath; - } - } - - if (clash) - { - filesToClean += String.Format(" .{0}-{1}-timestamp", project.Name, conf.Name); - f.WriteLine("\ttouch .{0}-{1}-timestamp", project.Name, conf.Name); - f.Write("\trm -rf"); - foreach (ConfigurationNode otherConf in project.Configurations) - if (otherConf != conf) - f.WriteLine(" .{0}-{1}-timestamp", project.Name, otherConf.Name); - f.WriteLine(); - } - f.WriteLine(); - f.WriteLine("{0}-{1}-clean:", project.Name, conf.Name); - f.WriteLine("\trm -rf {0}", filesToClean); - f.WriteLine(); - } - } - - private void WriteIntro(StreamWriter f, SolutionNode solution) - { - f.WriteLine("# Makefile for {0} generated by Prebuild ( http://dnpb.sf.net )", solution.Name); - f.WriteLine("# Do not edit."); - f.WriteLine("#"); - - f.Write("# Configurations:"); - foreach (ConfigurationNode conf in solution.Configurations) - f.Write(" {0}", conf.Name); - f.WriteLine(); - - f.WriteLine("# Projects:"); - foreach (ProjectNode proj in solution.Projects) - f.WriteLine("#\t{0}", proj.Name); - - f.WriteLine("#"); - f.WriteLine("# Building:"); - f.WriteLine("#\t\"make\" to build everything under the default(first) configuration"); - f.WriteLine("#\t\"make CONF\" to build every project under configuration CONF"); - f.WriteLine("#\t\"make PROJ\" to build project PROJ under the default(first) configuration"); - f.WriteLine("#\t\"make PROJ-CONF\" to build project PROJ under configuration CONF"); - f.WriteLine("#"); - f.WriteLine("# Cleaning (removing results of build):"); - f.WriteLine("#\t\"make clean\" to clean everything, that's what you probably want"); - f.WriteLine("#\t\"make CONF\" to clean everything for a configuration"); - f.WriteLine("#\t\"make PROJ\" to clean everything for a project"); - f.WriteLine("#\t\"make PROJ-CONF\" to clea project PROJ under configuration CONF"); - f.WriteLine(); - } - - private void WritePhony(StreamWriter f, SolutionNode solution) - { - string defconf = ""; - foreach (ConfigurationNode conf in solution.Configurations) - { - defconf = conf.Name; - break; - } - - f.Write(".PHONY: all"); - foreach (ProjectNode proj in solution.Projects) - f.Write(" {0} {0}-clean", proj.Name); - foreach (ConfigurationNode conf in solution.Configurations) - f.Write(" {0} {0}-clean", conf.Name); - foreach (ProjectNode proj in solution.Projects) - foreach (ConfigurationNode conf in solution.Configurations) - f.Write(" {0}-{1} {0}-{1}-clean", proj.Name, conf.Name); - f.WriteLine(); - f.WriteLine(); - - f.WriteLine("all: {0}", defconf); - f.WriteLine(); - - f.Write("clean:"); - foreach (ConfigurationNode conf in solution.Configurations) - f.Write(" {0}-clean", conf.Name); - f.WriteLine(); - f.WriteLine(); - - foreach (ConfigurationNode conf in solution.Configurations) - { - f.Write("{0}: ", conf.Name); - foreach (ProjectNode proj in solution.Projects) - f.Write(" {0}-{1}", proj.Name, conf.Name); - f.WriteLine(); - f.WriteLine(); - - f.Write("{0}-clean: ", conf.Name); - foreach (ProjectNode proj in solution.Projects) - f.Write(" {0}-{1}-clean", proj.Name, conf.Name); - f.WriteLine(); - f.WriteLine(); - } - - foreach (ProjectNode proj in solution.Projects) - { - f.WriteLine("{0}: {0}-{1}", proj.Name, defconf); - f.WriteLine(); - - f.Write("{0}-clean:", proj.Name); - foreach (ConfigurationNode conf in proj.Configurations) - f.Write(" {0}-{1}-clean", proj.Name, conf.Name); - f.WriteLine(); - f.WriteLine(); - } - } - - private void WriteSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Creating makefile for {0}", solution.Name); - m_Kernel.CurrentWorkingDirectory.Push(); - - string file = "Makefile";// Helper.MakeFilePath(solution.FullPath, solution.Name, "make"); - StreamWriter f = new StreamWriter(file); - - Helper.SetCurrentDir(Path.GetDirectoryName(file)); - - using (f) - { - WriteIntro(f, solution); - WritePhony(f, solution); - - foreach (ProjectNode project in solution.Projects) - { - m_Kernel.Log.Write("...Creating Project: {0}", project.Name); - WriteProject(f, solution, project); - } - } - - m_Kernel.Log.Write(""); - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning makefile for {0}", solution.Name); - - string file = Helper.MakeFilePath(solution.FullPath, solution.Name, "make"); - Helper.DeleteIfExists(file); - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - public void Write(Kernel kern) - { - m_Kernel = kern; - foreach (SolutionNode solution in kern.Solutions) - WriteSolution(solution); - m_Kernel = null; - } - - public virtual void Clean(Kernel kern) - { - m_Kernel = kern; - foreach (SolutionNode sol in kern.Solutions) - CleanSolution(sol); - m_Kernel = null; - } - - public string Name - { - get - { - return "makefile"; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/MonoDevelopTarget.cs b/Programs/Prebuild/src/Core/Targets/MonoDevelopTarget.cs deleted file mode 100644 index d9158d8d..00000000 --- a/Programs/Prebuild/src/Core/Targets/MonoDevelopTarget.cs +++ /dev/null @@ -1,473 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: dmoonfire $ - * $Date: 2008-12-14 13:35:55 -0800 (Sun, 14 Dec 2008) $ - * $Revision: 283 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("monodev")] - public class MonoDevelopTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - { - tmpPath = Helper.NormalizePath(tmpPath); - } - else - { - tmpPath = Helper.NormalizePath("./" + tmpPath); - } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if(refr.Path != null || fileRef != null) - { - ret += "Assembly\" refto=\""; - - string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; - - ret += finalPath; - ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; - return ret; - } - - ret += "Gac\""; - ret += " localcopy=\"" + refr.LocalCopy.ToString() + "\""; - ret += " refto=\""; - try - { - /* - Day changed to 28 Mar 2007 - ... - 08:09 < cj> is there anything that replaces Assembly.LoadFromPartialName() ? - 08:09 < jonp> no - 08:10 < jonp> in their infinite wisdom [sic], microsoft decided that the - ability to load any assembly version by-name was an inherently - bad idea - 08:11 < cj> I'm thinking of a bunch of four-letter words right now... - 08:11 < cj> security through making it difficult for the developer!!! - 08:12 < jonp> just use the Obsolete API - 08:12 < jonp> it should still work - 08:12 < cj> alrighty. - 08:12 < jonp> you just get warnings when using it - */ - Assembly assem = Assembly.LoadWithPartialName(refr.Name); - ret += assem.FullName; - //ret += refr.Name; - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += refr.Name; - } - ret += "\" />"; - } - - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach(ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if(File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - { - return "False"; - } - return "True"; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string csComp = "Mcs"; - string netRuntime = "Mono"; - if(project.Runtime == ClrRuntime.Microsoft) - { - csComp = "Csc"; - netRuntime = "MsNet"; - } - - string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - - using(ss) - { - ss.WriteLine( - "", - project.Name, - project.RootNamespace - ); - - int count = 0; - - ss.WriteLine(" ", solution.ActiveConfig); - - foreach(ConfigurationNode conf in project.Configurations) - { - ss.WriteLine(" ", conf.Name); - ss.Write(" "); - - ss.Write(" "); - - ss.Write(" "); - - ss.Write(" "); - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - - ss.Write(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(string file in project.Files) - { - string buildAction = "Compile"; - switch(project.Files.GetBuildAction(file)) - { - case BuildAction.None: - buildAction = "Nothing"; - break; - - case BuildAction.Content: - buildAction = "Exclude"; - break; - - case BuildAction.EmbeddedResource: - buildAction = "EmbedAsResource"; - break; - - default: - buildAction = "Compile"; - break; - } - - // Sort of a hack, we try and resolve the path and make it relative, if we can. - string filePath = PrependPath(file); - ss.WriteLine(" ", filePath, buildAction); - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - ss.WriteLine(" {0}", BuildReference(solution, refr)); - } - ss.WriteLine(" "); - - - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating MonoDevelop combine and project files"); - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - int count = 0; - - using(ss) - { - ss.WriteLine("", solution.Name); - - count = 0; - foreach(ConfigurationNode conf in solution.Configurations) - { - if(count == 0) - { - ss.WriteLine(" ", conf.Name); - } - - ss.WriteLine(" ", conf.Name); - foreach(ProjectNode project in solution.Projects) - { - ss.WriteLine(" ", project.Name, conf.Name); - } - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - - count = 0; - - foreach(ProjectNode project in solution.Projects) - { - if(count == 0) - ss.WriteLine(" ", project.Name); - - ss.WriteLine(" ", project.Name); - count++; - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine(" ", - Helper.MakeFilePath(path, project.Name, "mdp")); - } - ss.WriteLine(" "); - - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning MonoDevelop combine and project files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "mds"); - Helper.DeleteIfExists(slnFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "sharpdev"; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/NAntTarget.cs b/Programs/Prebuild/src/Core/Targets/NAntTarget.cs deleted file mode 100644 index 07625d2b..00000000 --- a/Programs/Prebuild/src/Core/Targets/NAntTarget.cs +++ /dev/null @@ -1,648 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 - 2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -C.J. Adams-Collier (cjac@colliertech.org), - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. -*/ - -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jhurliman $ - * $Date: 2008-12-17 14:18:25 -0800 (Wed, 17 Dec 2008) $ - * $Revision: 285 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("nant")] - public class NAntTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - //{ - tmpPath = Helper.NormalizePath(tmpPath); - //} - // else - // { - // tmpPath = Helper.NormalizePath("./" + tmpPath); - // } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - string fileRef = FindFileReference(refr.Name, project); - string finalPath = Helper.NormalizePath(Helper.MakeFilePath("${build.dir}/", refr.Name, GetExtension(refr.Name)), '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - string ext = GetExtension(refr.Name); - - if (refr.Path != null || fileRef != null) - { - string finalPath = (refr.Path != null) ? Helper.NormalizePath(Helper.MakeFilePath("${build.dir}/", refr.Name, ext), '/') : fileRef; - - ret += finalPath; - return ret; - } - - if (refr.Name.EndsWith(".exe") || refr.Name.EndsWith(".dll")) - ret += refr.Name; - else - ret += refr.Name + ".dll"; - } - return ret; - } - - private static string GetExtension(string refrName) - { - if (refrName.EndsWith(".exe") || refrName.EndsWith(".dll")) - return String.Empty; - else - return "dll"; - } - - private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - string fileRef = FindFileReference(refr.Name, project); - string finalPath = Helper.NormalizePath(Helper.MakeReferencePath("${build.dir}/"), '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if (refr.Path != null || fileRef != null) - { - string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; - ret += finalPath; - return ret; - } - - try - { - Assembly assem = Assembly.Load(refr.Name); - if (assem != null) - { - ret += ""; - } - else - { - ret += ""; - } - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += ""; - } - } - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if (File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if (conf == null) - { - throw new ArgumentNullException("conf"); - } - if (project == null) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - // { - // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - // } - return docFile; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - bool hasDoc = false; - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", project.Name); - ss.WriteLine(" ", "build"); - //ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.Write(" "); - ss.WriteLine(" ", project.RootNamespace); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.EmbeddedResource: - ss.WriteLine(" {0}", ""); - break; - default: - if (file.EndsWith(".resx") || (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)) - { - ss.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - } - break; - } - } - //if (project.Files.GetSubType(file).ToString() != "Code") - //{ - // ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.Compile: - if (!file.EndsWith(".resx")) - ss.WriteLine(" "); - break; - default: - break; - } - } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - ss.WriteLine(" ", '/')); - } - ss.WriteLine(" "); - - ArrayList suppressWarningsArray = new ArrayList(); - ss.WriteLine(" "); - foreach (ConfigurationNode conf in project.Configurations) - { - foreach (string s in conf.Options.SuppressWarnings.Split(new char[] { ',', ' ' })) - { - // duplicate check - if (!String.IsNullOrEmpty(s) && !suppressWarningsArray.Contains(s)) - { - suppressWarningsArray.Add(s); - ss.WriteLine(" ", s); - } - } - } - suppressWarningsArray.Clear(); - - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - if (hasDoc) - { - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.Write(" "); - } - else - { - ss.WriteLine(".exe\" />"); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - // foreach(ReferenceNode refr in project.References) - // { - // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); - // if (path != "") - // { - // ss.WriteLine(" ", path); - // } - // } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating NAnt build files"); - foreach (ProjectNode project in solution.Projects) - { - if (m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", solution.Name); - ss.WriteLine(" "); - ss.WriteLine(); - - //ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - foreach (ConfigurationNode conf in solution.Configurations) - { - // Set the project.config to a non-debug configuration - if (conf.Options["DebugInformation"].ToString().ToLower() != "true") - { - ss.WriteLine(" ", conf.Name); - } - ss.WriteLine(); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); - ss.WriteLine(" "); - ss.WriteLine(); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(" "); - ss.WriteLine(); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning NAnt build files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); - Helper.DeleteIfExists(slnFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "nant"; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/SharpDevelop2Target.cs b/Programs/Prebuild/src/Core/Targets/SharpDevelop2Target.cs deleted file mode 100644 index 7b51269e..00000000 --- a/Programs/Prebuild/src/Core/Targets/SharpDevelop2Target.cs +++ /dev/null @@ -1,91 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; - -using Prebuild.Core.Attributes; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("sharpdev2")] - public class SharpDevelop2Target : VS2005Target - { - #region Properties - public override string VersionName - { - get - { - return "SharpDevelop2"; - } - } - #endregion - - #region Public Methods - - /// - /// Writes the specified kern. - /// - /// The kern. - public override void Write(Kernel kern) - { - base.Write(kern); - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public override void Clean(Kernel kern) - { - base.Clean(kern); - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return "sharpdev2"; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/SharpDevelopTarget.cs b/Programs/Prebuild/src/Core/Targets/SharpDevelopTarget.cs deleted file mode 100644 index 08aab44c..00000000 --- a/Programs/Prebuild/src/Core/Targets/SharpDevelopTarget.cs +++ /dev/null @@ -1,437 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2007-02-13 12:58:03 -0800 (Tue, 13 Feb 2007) $ - * $Revision: 205 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Text.RegularExpressions; -using System.Reflection; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("sharpdev")] - public class SharpDevelopTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - { - tmpPath = Helper.NormalizePath(tmpPath); - } - else - { - tmpPath = Helper.NormalizePath("./" + tmpPath); - } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if(refr.Path != null || fileRef != null) - { - ret += "Assembly\" refto=\""; - - string finalPath = (refr.Path != null) ? Helper.MakeFilePath(refr.Path, refr.Name, "dll") : fileRef; - - ret += finalPath; - ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; - return ret; - } - - ret += "Gac\" refto=\""; - try - { - //Assembly assem = Assembly.Load(refr.Name); - ret += refr.Name;// assem.FullName; - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += refr.Name; - } - ret += "\" localcopy=\"" + refr.LocalCopy.ToString() + "\" />"; - } - - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach(ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if(File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - { - return "False"; - } - return "True"; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string csComp = "Csc"; - string netRuntime = "MsNet"; - if(project.Runtime == ClrRuntime.Mono) - { - csComp = "Mcs"; - netRuntime = "Mono"; - } - - string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - - using(ss) - { - ss.WriteLine( - "", - project.Name, - project.RootNamespace - ); - - ss.WriteLine(" "); - foreach(string file in project.Files) - { - string buildAction = "Compile"; - switch(project.Files.GetBuildAction(file)) - { - case BuildAction.None: - buildAction = "Nothing"; - break; - - case BuildAction.Content: - buildAction = "Exclude"; - break; - - case BuildAction.EmbeddedResource: - buildAction = "EmbedAsResource"; - break; - - default: - buildAction = "Compile"; - break; - } - - // Sort of a hack, we try and resolve the path and make it relative, if we can. - string filePath = PrependPath(file); - ss.WriteLine(" ", filePath, buildAction); - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - ss.WriteLine(" {0}", BuildReference(solution, refr)); - } - ss.WriteLine(" "); - - ss.Write(" "); - - int count = 0; - - ss.WriteLine(" ", solution.ActiveConfig); - - foreach(ConfigurationNode conf in project.Configurations) - { - ss.Write(" "); - ss.Write(" "); - - ss.Write(" "); - - ss.Write(" "); - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating SharpDevelop combine and project files"); - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string combFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using(ss) - { - ss.WriteLine("", solution.Name); - - int count = 0; - foreach(ProjectNode project in solution.Projects) - { - if(count == 0) - ss.WriteLine(" ", project.Name); - - ss.WriteLine(" ", project.Name); - count++; - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - foreach(ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine(" ", - Helper.MakeFilePath(path, project.Name, "prjx")); - } - ss.WriteLine(" "); - - count = 0; - foreach(ConfigurationNode conf in solution.Configurations) - { - if(count == 0) - { - ss.WriteLine(" ", conf.Name); - } - - ss.WriteLine(" ", conf.Name); - foreach(ProjectNode project in solution.Projects) - { - ss.WriteLine(" ", project.Name, conf.Name); - } - ss.WriteLine(" "); - - count++; - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "prjx"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning SharpDevelop combine and project files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "cmbx"); - Helper.DeleteIfExists(slnFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "sharpdev"; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/ToolInfo.cs b/Programs/Prebuild/src/Core/Targets/ToolInfo.cs deleted file mode 100644 index 8e006467..00000000 --- a/Programs/Prebuild/src/Core/Targets/ToolInfo.cs +++ /dev/null @@ -1,197 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - public struct ToolInfo - { - string name; - string guid; - string fileExtension; - string xmlTag; - string importProject; - - /// - /// Gets or sets the name. - /// - /// The name. - public string Name - { - get - { - return name; - } - set - { - name = value; - } - } - - /// - /// Gets or sets the GUID. - /// - /// The GUID. - public string Guid - { - get - { - return guid; - } - set - { - guid = value; - } - } - - /// - /// Gets or sets the file extension. - /// - /// The file extension. - public string FileExtension - { - get - { - return fileExtension; - } - set - { - fileExtension = value; - } - } - public string LanguageExtension - { - get - { - switch (this.Name) - { - case "C#": - return ".cs"; - case "VisualBasic": - return ".vb"; - case "Boo": - return ".boo"; - default: - return ".cs"; - } - } - } - /// - /// Gets or sets the XML tag. - /// - /// The XML tag. - public string XmlTag - { - get - { - return xmlTag; - } - set - { - xmlTag = value; - } - } - - /// - /// Gets or sets the import project property. - /// - /// The ImportProject tag. - public string ImportProject - { - get - { - return importProject; - } - set - { - importProject = value; - } - } - - /// - /// Initializes a new instance of the class. - /// - /// The name. - /// The GUID. - /// The file extension. - /// The XML. - /// The import project. - public ToolInfo(string name, string guid, string fileExtension, string xml, string importProject) - { - this.name = name; - this.guid = guid; - this.fileExtension = fileExtension; - this.xmlTag = xml; - this.importProject = importProject; - } - - /// - /// Initializes a new instance of the class. - /// - /// The name. - /// The GUID. - /// The file extension. - /// The XML. - public ToolInfo(string name, string guid, string fileExtension, string xml) - { - this.name = name; - this.guid = guid; - this.fileExtension = fileExtension; - this.xmlTag = xml; - this.importProject = "$(MSBuildBinPath)\\Microsoft." + xml + ".Targets"; - } - - /// - /// Equals operator - /// - /// ToolInfo to compare - /// true if toolInfos are equal - public override bool Equals(object obj) - { - if (obj == null) - { - throw new ArgumentNullException("obj"); - } - if (obj.GetType() != typeof(ToolInfo)) - return false; - - ToolInfo c = (ToolInfo)obj; - return ((this.name == c.name) && (this.guid == c.guid) && (this.fileExtension == c.fileExtension) && (this.importProject == c.importProject)); - } - - /// - /// Equals operator - /// - /// ToolInfo to compare - /// ToolInfo to compare - /// True if toolInfos are equal - public static bool operator ==(ToolInfo c1, ToolInfo c2) - { - return ((c1.name == c2.name) && (c1.guid == c2.guid) && (c1.fileExtension == c2.fileExtension) && (c1.importProject == c2.importProject) && (c1.xmlTag == c2.xmlTag)); - } - - /// - /// Not equals operator - /// - /// ToolInfo to compare - /// ToolInfo to compare - /// True if toolInfos are not equal - public static bool operator !=(ToolInfo c1, ToolInfo c2) - { - return !(c1 == c2); - } - - /// - /// Hash Code - /// - /// Hash code - public override int GetHashCode() - { - return name.GetHashCode() ^ guid.GetHashCode() ^ this.fileExtension.GetHashCode() ^ this.importProject.GetHashCode() ^ this.xmlTag.GetHashCode(); - - } - } -} diff --git a/Programs/Prebuild/src/Core/Targets/VS2002Target.cs b/Programs/Prebuild/src/Core/Targets/VS2002Target.cs deleted file mode 100644 index 81e00080..00000000 --- a/Programs/Prebuild/src/Core/Targets/VS2002Target.cs +++ /dev/null @@ -1,96 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; - -using Prebuild.Core.Attributes; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("vs2002")] - public class VS2002Target : VS2003Target - { - #region Private Methods - - private void SetVS2002() - { - this.SolutionVersion = "7.00"; - this.ProductVersion = "7.0.9254"; - this.SchemaVersion = "1.0"; - this.VersionName = "2002"; - this.Version = VSVersion.VS70; - } - - #endregion - - #region Public Methods - - /// - /// Writes the specified kern. - /// - /// The kern. - public override void Write(Kernel kern) - { - SetVS2002(); - base.Write(kern); - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public override void Clean(Kernel kern) - { - SetVS2002(); - base.Clean(kern); - } - - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return "vs2002"; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/VS2003Target.cs b/Programs/Prebuild/src/Core/Targets/VS2003Target.cs deleted file mode 100644 index 7f5b3ecd..00000000 --- a/Programs/Prebuild/src/Core/Targets/VS2003Target.cs +++ /dev/null @@ -1,611 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: sontek $ - * $Date: 2008-04-24 15:21:41 -0700 (Thu, 24 Apr 2008) $ - * $Revision: 259 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - [Target("vs2003")] - public class VS2003Target : ITarget - { - - #region Fields - - string solutionVersion = "8.00"; - string productVersion = "7.10.3077"; - string schemaVersion = "2.0"; - string versionName = "2003"; - VSVersion version = VSVersion.VS71; - - Hashtable m_Tools; - Kernel m_Kernel; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - protected string SolutionVersion - { - get - { - return this.solutionVersion; - } - set - { - this.solutionVersion = value; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - protected string ProductVersion - { - get - { - return this.productVersion; - } - set - { - this.productVersion = value; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - protected string SchemaVersion - { - get - { - return this.schemaVersion; - } - set - { - this.schemaVersion = value; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - protected string VersionName - { - get - { - return this.versionName; - } - set - { - this.versionName = value; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - protected VSVersion Version - { - get - { - return this.version; - } - set - { - this.version = value; - } - } - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2003Target() - { - m_Tools = new Hashtable(); - - m_Tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP"); - m_Tools["VB.NET"] = new ToolInfo("VB.NET", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic"); - } - - #endregion - - #region Private Methods - - private string MakeRefPath(ProjectNode project) - { - string ret = ""; - foreach(ReferencePathNode node in project.ReferencePaths) - { - try - { - string fullPath = Helper.ResolvePath(node.Path); - if(ret.Length < 1) - { - ret = fullPath; - } - else - { - ret += ";" + fullPath; - } - } - catch(ArgumentException) - { - m_Kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); - } - } - - return ret; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - if(!m_Tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - StreamWriter ps = new StreamWriter(projectFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - IEnumerator enumerator; - //ConfigurationNode scripts; - - using(ps) - { - ps.WriteLine(""); - ps.WriteLine(" <{0}", toolInfo.XmlTag); - ps.WriteLine("\t\t\t\tProjectType = \"Local\""); - ps.WriteLine("\t\t\t\tProductVersion = \"{0}\"", this.ProductVersion); - ps.WriteLine("\t\t\t\tSchemaVersion = \"{0}\"", this.SchemaVersion); - ps.WriteLine("\t\t\t\tProjectGuid = \"{{{0}}}\"", project.Guid.ToString().ToUpper()); - ps.WriteLine("\t\t>"); - - ps.WriteLine("\t\t\t\t"); - ps.WriteLine(" "); - - foreach(ConfigurationNode conf in project.Configurations) - { - ps.WriteLine("\t\t\t\t "); - } - - ps.WriteLine(" "); - - ps.WriteLine(" "); - foreach(ReferenceNode refr in project.References) - { - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - ps.WriteLine(" "); - ps.WriteLine(" "); - - ps.WriteLine(" "); - - foreach(string file in project.Files) - { - string fileName = file.Replace(".\\", ""); - ps.WriteLine(" "); - - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ps.WriteLine(" "); - - } - } - ps.WriteLine(" "); - - ps.WriteLine(" "); - ps.WriteLine(" ", toolInfo.XmlTag); - ps.WriteLine(""); - } - - ps = new StreamWriter(projectFile + ".user"); - using(ps) - { - ps.WriteLine(""); - ps.WriteLine(" <{0}>", toolInfo.XmlTag); - ps.WriteLine(" "); - - ps.WriteLine(" ", MakeRefPath(project)); - foreach(ConfigurationNode conf in project.Configurations) - { - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - ps.WriteLine(" "); - ps.WriteLine(" ", toolInfo.XmlTag); - ps.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if( conf == null ) - { - throw new ArgumentNullException("conf"); - } - if( project == null ) - { - throw new ArgumentNullException("project"); - } - // if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false - // { - // return string.Empty; - // } - - //default to "AssemblyName.xml" - //string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - //return (string)conf.Options["XmlDocFile", defaultValue]; - - //default to no XmlDocFile file - return (string)conf.Options["XmlDocFile", ""]; - } - - private void WriteSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Creating Visual Studio {0} solution and project files", this.VersionName); - - foreach(ProjectNode project in solution.Projects) - { - if(m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - StreamWriter ss = new StreamWriter(solutionFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); - - using(ss) - { - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); - foreach(ProjectNode project in solution.Projects) - { - if(!m_Tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; - - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.WriteLine("Project(\"{0}\") = \"{1}\", \"{2}\", \"{{{3}}}\"", - toolInfo.Guid, project.Name, Helper.MakeFilePath(path, project.Name, - toolInfo.FileExtension), project.Guid.ToString().ToUpper()); - - ss.WriteLine("\tProjectSection(ProjectDependencies) = postProject"); - ss.WriteLine("\tEndProjectSection"); - - ss.WriteLine("EndProject"); - } - - ss.WriteLine("Global"); - - ss.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution"); - foreach(ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{0} = {0}", conf.Name); - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectDependencies) = postSolution"); - foreach(ProjectNode project in solution.Projects) - { - for(int i = 0; i < project.References.Count; i++) - { - ReferenceNode refr = (ReferenceNode)project.References[i]; - if(solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode refProject = (ProjectNode)solution.ProjectsTable[refr.Name]; - ss.WriteLine("\t\t({{{0}}}).{1} = ({{{2}}})", - project.Guid.ToString().ToUpper() - , i, - refProject.Guid.ToString().ToUpper() - ); - } - } - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution"); - foreach(ProjectNode project in solution.Projects) - { - foreach(ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{{{0}}}.{1}.ActiveCfg = {1}|.NET", - project.Guid.ToString().ToUpper(), - conf.Name); - - ss.WriteLine("\t\t{{{0}}}.{1}.Build.0 = {1}|.NET", - project.Guid.ToString().ToUpper(), - conf.Name); - } - } - ss.WriteLine("\tEndGlobalSection"); - - if(solution.Files != null) - { - ss.WriteLine("\tGlobalSection(SolutionItems) = postSolution"); - foreach(string file in solution.Files) - { - ss.WriteLine("\t\t{0} = {0}", file); - } - ss.WriteLine("\tEndGlobalSection"); - } - - ss.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution"); - ss.WriteLine("\tEndGlobalSection"); - ss.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution"); - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("EndGlobal"); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - - ToolInfo toolInfo = (ToolInfo)m_Tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - string userFile = projectFile + ".user"; - - Helper.DeleteIfExists(projectFile); - Helper.DeleteIfExists(userFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning Visual Studio {0} solution and project files", this.VersionName, solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); - - Helper.DeleteIfExists(slnFile); - Helper.DeleteIfExists(suoFile); - - foreach(ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public virtual void Write(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in m_Kernel.Solutions) - { - WriteSolution(sol); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if( kern == null ) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach(SolutionNode sol in m_Kernel.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public virtual string Name - { - get - { - return "vs2003"; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/VS2005Target.cs b/Programs/Prebuild/src/Core/Targets/VS2005Target.cs deleted file mode 100644 index fd8611cb..00000000 --- a/Programs/Prebuild/src/Core/Targets/VS2005Target.cs +++ /dev/null @@ -1,151 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: sontek $ - * $Date: 2008-05-07 13:59:35 -0700 (Wed, 07 May 2008) $ - * $Revision: 270 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("vs2005")] - public class VS2005Target : VSGenericTarget - { - #region Inner Classes - - #endregion - - #region Fields - - string solutionVersion = "9.00"; - string productVersion = "8.0.50727"; - string schemaVersion = "2.0"; - string versionName = "Visual C# 2005"; - string name = "vs2005"; - - VSVersion version = VSVersion.VS80; - - Hashtable tools; - Kernel kernel; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public override string SolutionVersion - { - get - { - return solutionVersion; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - public override string ProductVersion - { - get - { - return productVersion; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public override string SchemaVersion - { - get - { - return schemaVersion; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public override string VersionName - { - get - { - return versionName; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - public override VSVersion Version - { - get - { - return version; - } - } - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return name; - } - } - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2005Target() - : base() - { - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/VS2008Target.cs b/Programs/Prebuild/src/Core/Targets/VS2008Target.cs deleted file mode 100644 index e9162a5e..00000000 --- a/Programs/Prebuild/src/Core/Targets/VS2008Target.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; - -namespace Prebuild.Core.Targets -{ - - /// - /// - /// - [Target("vs2008")] - public class VS2008Target : VSGenericTarget - { - #region Fields - string solutionVersion = "10.00"; - string productVersion = "9.0.21022"; - string schemaVersion = "2.0"; - string versionName = "Visual Studio 2008"; - string name = "vs2008"; - VSVersion version = VSVersion.VS90; - - Hashtable tools; - Kernel kernel; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public override string SolutionVersion - { - get - { - return solutionVersion; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - public override string ProductVersion - { - get - { - return productVersion; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public override string SchemaVersion - { - get - { - return schemaVersion; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public override string VersionName - { - get - { - return versionName; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - public override VSVersion Version - { - get - { - return version; - } - } - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return name; - } - } - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2008Target() - : base() - { - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/VS2010Target.cs b/Programs/Prebuild/src/Core/Targets/VS2010Target.cs deleted file mode 100644 index 93939824..00000000 --- a/Programs/Prebuild/src/Core/Targets/VS2010Target.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; - -namespace Prebuild.Core.Targets -{ - - /// - /// - /// - [Target("vs2010")] - public class VS2010Target : VSGenericTarget - { - #region Fields - string solutionVersion = "11.00"; - string productVersion = "10.0.20506"; - string schemaVersion = "2.0"; - string versionName = "Visual Studio 2010"; - string name = "vs2010"; - VSVersion version = VSVersion.VS10; - - Hashtable tools; - Kernel kernel; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public override string SolutionVersion - { - get - { - return solutionVersion; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - public override string ProductVersion - { - get - { - return productVersion; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public override string SchemaVersion - { - get - { - return schemaVersion; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public override string VersionName - { - get - { - return versionName; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - public override VSVersion Version - { - get - { - return version; - } - } - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return name; - } - } - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2010Target() - : base() - { - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/VS2012Target.cs b/Programs/Prebuild/src/Core/Targets/VS2012Target.cs deleted file mode 100644 index 594b8bb0..00000000 --- a/Programs/Prebuild/src/Core/Targets/VS2012Target.cs +++ /dev/null @@ -1,113 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; - -namespace Prebuild.Core.Targets -{ - - /// - /// - /// - [Target("vs2012")] - public class VS2012Target : VSGenericTarget - { - #region Fields - string solutionVersion = "12.00"; - string productVersion = "11.0.51106.01"; - string schemaVersion = "2.0"; - string versionName = "Visual Studio 2012"; - string name = "vs2012"; - VSVersion version = VSVersion.VS11; - - Hashtable tools; - Kernel kernel; - - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public override string SolutionVersion - { - get - { - return solutionVersion; - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - public override string ProductVersion - { - get - { - return productVersion; - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public override string SchemaVersion - { - get - { - return schemaVersion; - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public override string VersionName - { - get - { - return versionName; - } - } - /// - /// Gets or sets the version. - /// - /// The version. - public override VSVersion Version - { - get - { - return version; - } - } - /// - /// Gets the name. - /// - /// The name. - public override string Name - { - get - { - return name; - } - } - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VS2012Target() - : base() - { - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/VSGenericTarget.cs b/Programs/Prebuild/src/Core/Targets/VSGenericTarget.cs deleted file mode 100644 index ccf576b8..00000000 --- a/Programs/Prebuild/src/Core/Targets/VSGenericTarget.cs +++ /dev/null @@ -1,978 +0,0 @@ -#region BSD License -/* -Copyright (c) 2008 Matthew Holmes (matthew@wildfiregames.com), John Anderson (sontek@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Text; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; -using System.CodeDom.Compiler; - -namespace Prebuild.Core.Targets -{ - - /// - /// - /// - public abstract class VSGenericTarget : ITarget - { - #region Fields - Hashtable tools; - Kernel kernel; - #endregion - - #region Properties - /// - /// Gets or sets the solution version. - /// - /// The solution version. - public virtual string SolutionVersion - { - get - { - throw new NotImplementedException("You need to override the SolutionVersion property"); - } - } - /// - /// Gets or sets the product version. - /// - /// The product version. - public virtual string ProductVersion - { - get - { - throw new NotImplementedException("You need to override the ProductVersion property"); - } - } - /// - /// Gets or sets the schema version. - /// - /// The schema version. - public virtual string SchemaVersion - { - get - { - throw new NotImplementedException("You need to override the SchemaVersion property"); - } - } - /// - /// Gets or sets the name of the version. - /// - /// The name of the version. - public virtual string VersionName - { - get - { - throw new NotImplementedException("You need to override the VersionName property"); - } - } - /// - /// Gets or sets the version. - /// - /// The version. - public virtual VSVersion Version - { - get - { - throw new NotImplementedException("You need to override the VersionName property"); - } - } - /// - /// Gets the name. - /// - /// The name. - public virtual string Name - { - get - { - throw new NotImplementedException("You need to override the Name property"); - } - } - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public VSGenericTarget() - { - this.tools = new Hashtable(); - - this.tools["C#"] = new ToolInfo("C#", "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}", "csproj", "CSHARP", "$(MSBuildBinPath)\\Microsoft.CSHARP.Targets"); - this.tools["Database"] = new ToolInfo("Database", "{4F174C21-8C12-11D0-8340-0000F80270F8}", "dbp", "UNKNOWN"); - this.tools["Boo"] = new ToolInfo("Boo", "{45CEA7DC-C2ED-48A6-ACE0-E16144C02365}", "booproj", "Boo", "$(BooBinPath)\\Boo.Microsoft.Build.targets"); - this.tools["VisualBasic"] = new ToolInfo("VisualBasic", "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}", "vbproj", "VisualBasic", "$(MSBuildBinPath)\\Microsoft.VisualBasic.Targets"); - this.tools["Folder"] = new ToolInfo("Folder", "{2150E333-8FDC-42A3-9474-1A3956D46DE8}", null, null); - } - - #endregion - - #region Private Methods - - private string MakeRefPath(ProjectNode project) - { - string ret = ""; - foreach (ReferencePathNode node in project.ReferencePaths) - { - try - { - string fullPath = Helper.ResolvePath(node.Path); - if (ret.Length < 1) - { - ret = fullPath; - } - else - { - ret += ";" + fullPath; - } - } - catch (ArgumentException) - { - this.kernel.Log.Write(LogType.Warning, "Could not resolve reference path: {0}", node.Path); - } - } - - return ret; - } - - private static ProjectNode FindProjectInSolution(string name, SolutionNode solution) - { - SolutionNode node = solution; - - while (node.Parent is SolutionNode) - node = node.Parent as SolutionNode; - - return FindProjectInSolutionRecursively(name, node); - } - - private static ProjectNode FindProjectInSolutionRecursively(string name, SolutionNode solution) - { - name = name.Replace(".exe", String.Empty); - - if (solution.ProjectsTable.ContainsKey(name.Replace(".exe", String.Empty))) - return (ProjectNode)solution.ProjectsTable[name]; - - foreach (SolutionNode child in solution.Solutions) - { - ProjectNode node = FindProjectInSolutionRecursively(name, child); - if (node != null) - return node; - } - - return null; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - if (!tools.ContainsKey(project.Language)) - { - throw new UnknownLanguageException("Unknown .NET language: " + project.Language); - } - - ToolInfo toolInfo = (ToolInfo)tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - StreamWriter ps = new StreamWriter(projectFile); - - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - #region Project File - using (ps) - { - ps.WriteLine("", (this.Version == VSVersion.VS10 || this.Version == VSVersion.VS11) ? "4.0" : "3.5"); - ps.WriteLine(" "); - ps.WriteLine(" Local"); - ps.WriteLine(" {0}", this.ProductVersion); - ps.WriteLine(" {0}", this.SchemaVersion); - ps.WriteLine(" {{{0}}}", project.Guid.ToString().ToUpper()); - - // Visual Studio has a hard coded guid for the project type - if (project.Type == ProjectType.Web) - ps.WriteLine(" {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}"); - ps.WriteLine(" Debug"); - ps.WriteLine(" AnyCPU"); - ps.WriteLine(" {0}", project.AppIcon); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", project.AssemblyName); - foreach (ConfigurationNode conf in project.Configurations) - { - if (conf.Options.KeyFile != "") - { - ps.WriteLine(" {0}", conf.Options.KeyFile); - ps.WriteLine(" true"); - break; - } - } - ps.WriteLine(" JScript"); - ps.WriteLine(" Grid"); - ps.WriteLine(" IE50"); - ps.WriteLine(" false"); - ps.WriteLine(" {0}", project.FrameworkVersion.ToString().Replace("_", ".")); - - ps.WriteLine(" {0}", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString()); - ps.WriteLine(" {0}", project.DesignerFolder); - ps.WriteLine(" {0}", project.RootNamespace); - ps.WriteLine(" {0}", project.StartupObject); - ps.WriteLine(" "); - ps.WriteLine(" "); - - ps.WriteLine(" "); - - foreach (ConfigurationNode conf in project.Configurations) - { - string compilerDefines = conf.Options["CompilerDefines"].ToString(); - if (compilerDefines != String.Empty) compilerDefines += ";"; - compilerDefines += "VISUAL_STUDIO"; - - ps.Write(" ", conf.Name); - ps.WriteLine(" {0}", conf.Options["AllowUnsafe"]); - ps.WriteLine(" {0}", conf.Options["BaseAddress"]); - ps.WriteLine(" {0}", conf.Options["CheckUnderflowOverflow"]); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" {0}", compilerDefines); - ps.WriteLine(" {0}", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString())); - ps.WriteLine(" {0}", conf.Options["DebugInformation"]); - ps.WriteLine(" {0}", conf.Options["FileAlignment"]); - ps.WriteLine(" {0}", conf.Options["OptimizeCode"]); - if (project.Type != ProjectType.Web) - ps.WriteLine(" {0}", - Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString()))); - else - ps.WriteLine(" {0}", - Helper.EndPath(Helper.NormalizePath("bin\\"))); - - ps.WriteLine(" {0}", conf.Options["RegisterComInterop"]); - ps.WriteLine(" {0}", conf.Options["RemoveIntegerChecks"]); - ps.WriteLine(" {0}", conf.Options["WarningsAsErrors"]); - ps.WriteLine(" {0}", conf.Options["WarningLevel"]); - ps.WriteLine(" {0}", conf.Options["NoStdLib"]); - ps.WriteLine(" {0}", conf.Options["SuppressWarnings"]); - ps.WriteLine(" {0}", conf.Options.PlatformTarget); - ps.WriteLine(" "); - } - - //ps.WriteLine(" "); - - ArrayList projectReferences = new ArrayList(), - otherReferences = new ArrayList(); - - foreach (ReferenceNode refr in project.References) - { - ProjectNode projectNode = FindProjectInSolution(refr.Name, solution); - - if (projectNode == null) - { - if (!otherReferences.Contains(refr)) - otherReferences.Add(refr); - } - else - { - refr.Name = refr.Name.Replace(".exe", String.Empty); - projectReferences.Add(projectNode); - } - } - // Assembly References - ps.WriteLine(" "); - foreach (ReferenceNode refr in otherReferences) - { - ps.Write(" "); - ps.Write(" "); - ps.Write(refr.Name); - ps.WriteLine(""); - - // TODO: Allow reference to *.exe files - if (!String.IsNullOrEmpty(refr.Path)) - { - ps.WriteLine(" {0}", Helper.MakePathRelativeTo(project.FullPath, refr.Path + "\\" + refr.Name + ".dll")); - } - else - { - foreach (ReferencePathNode node in project.ReferencePaths) - { - try - { - string fullRefPath = Helper.ResolvePath(node.Path); - if (File.Exists(fullRefPath + refr.Name + ".dll")) - { - ps.WriteLine(" {0}", fullRefPath + refr.Name + ".dll"); - break; - } - else if (File.Exists(fullRefPath + refr.Name + ".exe")) - { - ps.WriteLine(" {0}", fullRefPath + refr.Name + ".exe"); - break; - } - } - catch (Exception) - { } - } - } - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - //Project References - ps.WriteLine(" "); - foreach (ProjectNode projectReference in projectReferences) - { - ToolInfo tool = (ToolInfo)tools[projectReference.Language]; - if (tools == null) - throw new UnknownLanguageException(); - - // TODO: Allow reference to visual basic projects - ps.WriteLine(" ", Helper.MakePathRelativeTo(project.FullPath, Helper.MakeFilePath(projectReference.FullPath, projectReference.Name, tool.FileExtension))); - ps.WriteLine(" {0}", projectReference.Name); - ps.WriteLine(" {0}", projectReference.Guid.ToString("B").ToUpper()); - ps.WriteLine(" {0}", tool.Guid.ToUpper()); - ps.WriteLine(" "); - } - ps.WriteLine(" "); - - // ps.WriteLine(" "); - ps.WriteLine(" "); - - // ps.WriteLine(" "); - ArrayList list = new ArrayList(); - ArrayList filesToRemove = new ArrayList(); - - foreach (string path in project.Files) - { - string lower = path.ToLower(); - if (lower.EndsWith(".resx")) - { - string codebehind = String.Format("{0}.Designer{1}", path.Substring(0, path.LastIndexOf('.')), toolInfo.LanguageExtension); - if (!list.Contains(codebehind)) - list.Add(codebehind); - } - } - - foreach (string file in project.Files) - { - // if (file == "Properties\\Bind.Designer.cs") - // { - // Console.WriteLine("Wait a minute!"); - // Console.WriteLine(project.Files.GetSubType(file).ToString()); - // } - - SubType subType = project.Files.GetSubType(file); - - if (file.EndsWith("Settings.Designer.cs")) - subType = SubType.Settings; - - if (subType != SubType.Code && subType != SubType.Settings && subType != SubType.Designer - && subType != SubType.CodeBehind) - { - ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - ps.WriteLine(" {0}", Path.GetFileName(file)); - //ps.WriteLine(" Designer"); - ps.WriteLine(" "); - } - - if (subType == SubType.Designer) - { - ps.WriteLine(" ", file); - - - string autogen_name = file.Substring(0, file.LastIndexOf('.')) + ".Designer.cs"; - string dependent_name = file.Substring(0, file.LastIndexOf('.')) + ".cs"; - - // Check for a parent .cs file with the same name as this designer file - if (File.Exists(dependent_name)) - { - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - } - else - { - /* - * These two lines screw up the designer, ie: if you make a change to a form, - * when you press Save VS corrups the .Designer.cs file - */ - ps.WriteLine(" ResXFileCodeGenerator"); - ps.WriteLine(" {0}", Path.GetFileName(autogen_name)); - ps.WriteLine(" " + subType + ""); - } - - ps.WriteLine(" "); - /*if (File.Exists(autogen_name)) - { - ps.WriteLine(" ", autogen_name); - //ps.WriteLine(" True"); - - // If a parent .cs file exists, link this autogen file to it. Otherwise link - // to the designer file - if (File.Exists(dependent_name)) - { - ps.WriteLine(" {0}", Path.GetFileName(dependent_name)); - } - else - { - ps.WriteLine(" True"); - ps.WriteLine(" {0}", Path.GetFileName(file)); - } - - ps.WriteLine(" "); - }*/ - - if (!list.Contains(autogen_name)) - list.Add(autogen_name); - } - if (subType == SubType.Settings) - { - ps.Write(" <{0} ", project.Files.GetBuildAction(file)); - ps.WriteLine("Include=\"{0}\">", file); - string fileName = Path.GetFileName(file); - if (project.Files.GetBuildAction(file) == BuildAction.None) - { - ps.WriteLine(" SettingsSingleFileGenerator"); - ps.WriteLine(" {0}", fileName.Substring(0, fileName.LastIndexOf('.')) + ".Designer.cs"); - } - else - { - string fileNameShort = fileName.Substring(0, fileName.LastIndexOf('.')); - string fileNameShorter = fileNameShort.Substring(0, fileNameShort.LastIndexOf('.')); - - ps.WriteLine(" True"); - ps.WriteLine(" {0}", Path.GetFileName(fileNameShorter + ".settings")); - ps.WriteLine(" True"); - } - ps.WriteLine(" ", project.Files.GetBuildAction(file)); - } - else if (subType != SubType.Designer) - { - string path = Helper.NormalizePath(file); - string path_lower = path.ToLower(); - - //if (!list.Contains(file)) - { - ps.Write(" <{0} ", project.Files.GetBuildAction(path)); - - int startPos = 0; - if (project.Files.GetPreservePath(file)) - { - while ((@"./\").IndexOf(file.Substring(startPos, 1)) != -1) - startPos++; - - } - else - { - startPos = file.LastIndexOf(Path.GetFileName(path)); - } - - ps.WriteLine("Include=\"{0}\">", path); - - int last_period_index = file.LastIndexOf('.'); - string short_file_name = file.Substring(0, last_period_index); - string extension = Path.GetExtension(path); - string designer_format = string.Format(".designer{0}", extension); - - if (path_lower.EndsWith(designer_format)) - { - int designer_index = path_lower.IndexOf(designer_format); - string file_name = path.Substring(0, designer_index); - - if (File.Exists(file_name + ".cs")) - { - ps.WriteLine(" {0}", Path.GetFileName(file_name + ".cs")); - } - else if (File.Exists(file_name + ".resx")) - { - ps.WriteLine(" True"); - ps.WriteLine(" {0}", Path.GetFileName(file_name + ".resx")); - } - } - else if (subType == SubType.CodeBehind) - { - ps.WriteLine(" {0}", Path.GetFileName(short_file_name)); - } - if (project.Files.GetIsLink(file)) - { - string alias = project.Files.GetLinkPath(file); - alias += file.Substring(startPos); - alias = Helper.NormalizePath(alias); - ps.WriteLine(" {0}", alias); - } - else if (project.Files.GetBuildAction(file) != BuildAction.None) - { - if (project.Files.GetBuildAction(file) != BuildAction.EmbeddedResource) - { - //HACK: Ugly method of supporting WinForms - if (file.Contains("frm") && !file.Contains("Designer.cs")) - ps.WriteLine(" Form"); - //else - // ps.WriteLine(" {0}", subType); - } - } - - if (project.Files.GetCopyToOutput(file) != CopyToOutput.Never) - { - ps.WriteLine(" {0}", project.Files.GetCopyToOutput(file)); - } - - ps.WriteLine(" ", project.Files.GetBuildAction(file)); - } - } - } - - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(" "); - ps.WriteLine(""); - } - #endregion - - #region User File - - ps = new StreamWriter(projectFile + ".user"); - using (ps) - { - ps.WriteLine(""); - //ps.WriteLine( "" ); - //ps.WriteLine(" <{0}>", toolInfo.XMLTag); - //ps.WriteLine(" "); - ps.WriteLine(" "); - //ps.WriteLine(" ", MakeRefPath(project)); - ps.WriteLine(" Debug"); - ps.WriteLine(" AnyCPU"); - ps.WriteLine(" {0}", MakeRefPath(project)); - ps.WriteLine(" {0}", this.ProductVersion); - ps.WriteLine(" ProjectFiles"); - ps.WriteLine(" 0"); - ps.WriteLine(" "); - foreach (ConfigurationNode conf in project.Configurations) - { - ps.Write(" "); - } - //ps.WriteLine(" "); - - //ps.WriteLine(" "); - //ps.WriteLine(" ", toolInfo.XMLTag); - //ps.WriteLine(""); - ps.WriteLine(""); - } - #endregion - - kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteSolution(SolutionNode solution, bool writeSolutionToDisk) - { - kernel.Log.Write("Creating {0} solution and project files", this.VersionName); - - foreach (SolutionNode child in solution.Solutions) - { - kernel.Log.Write("...Creating folder: {0}", child.Name); - WriteSolution(child, false); - } - - foreach (ProjectNode project in solution.Projects) - { - kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - - foreach (DatabaseProjectNode project in solution.DatabaseProjects) - { - kernel.Log.Write("...Creating database project: {0}", project.Name); - WriteDatabaseProject(solution, project); - } - - if (writeSolutionToDisk) // only write main solution - { - kernel.Log.Write(""); - string solutionFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - StreamWriter ss = new StreamWriter(solutionFile); - - kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(solutionFile)); - - using (ss) - { - ss.WriteLine("Microsoft Visual Studio Solution File, Format Version {0}", this.SolutionVersion); - - switch (this.Version) - { - case VSVersion.VS70: - case VSVersion.VS71: - ss.WriteLine("# Visual Studio 2003"); - break; - case VSVersion.VS80: - ss.WriteLine("# Visual Studio 2005"); - break; - case VSVersion.VS90: - ss.WriteLine("# Visual Studio 2008"); - break; - case VSVersion.VS10: - ss.WriteLine("# Visual Studio 2010"); - break; - } - - WriteProjectDeclarations(ss, solution, solution); - - ss.WriteLine("Global"); - - ss.WriteLine("\tGlobalSection(SolutionConfigurationPlatforms) = preSolution"); - foreach (ConfigurationNode conf in solution.Configurations) - { - ss.WriteLine("\t\t{0}|Any CPU = {0}|Any CPU", conf.Name); - } - ss.WriteLine("\tEndGlobalSection"); - - ss.WriteLine("\tGlobalSection(ProjectConfigurationPlatforms) = postSolution"); - WriteConfigurationLines(solution.Configurations, solution, ss); - ss.WriteLine("\tEndGlobalSection"); - - if (solution.Solutions.Count > 0) - { - ss.WriteLine("\tGlobalSection(NestedProjects) = preSolution"); - foreach (SolutionNode embeddedSolution in solution.Solutions) - { - WriteNestedProjectMap(ss, embeddedSolution); - } - ss.WriteLine("\tEndGlobalSection"); - } - - ss.WriteLine("EndGlobal"); - } - - kernel.CurrentWorkingDirectory.Pop(); - } - } - - private void WriteProjectDeclarations(StreamWriter writer, SolutionNode actualSolution, SolutionNode embeddedSolution) - { - foreach (SolutionNode childSolution in embeddedSolution.Solutions) - { - WriteEmbeddedSolution(writer, childSolution); - WriteProjectDeclarations(writer, actualSolution, childSolution); - } - - foreach (ProjectNode project in embeddedSolution.Projects) - { - WriteProject(actualSolution, writer, project); - } - - foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) - { - WriteProject(actualSolution, writer, dbProject); - } - - if (actualSolution.Guid == embeddedSolution.Guid) - { - WriteSolutionFiles(actualSolution, writer); - } - } - - private static void WriteNestedProjectMap(StreamWriter writer, SolutionNode embeddedSolution) - { - foreach (ProjectNode project in embeddedSolution.Projects) - { - WriteNestedProject(writer, embeddedSolution, project.Guid); - } - - foreach (DatabaseProjectNode dbProject in embeddedSolution.DatabaseProjects) - { - WriteNestedProject(writer, embeddedSolution, dbProject.Guid); - } - - foreach (SolutionNode child in embeddedSolution.Solutions) - { - WriteNestedProject(writer, embeddedSolution, child.Guid); - WriteNestedProjectMap(writer, child); - } - } - - private static void WriteNestedProject(StreamWriter writer, SolutionNode solution, Guid projectGuid) - { - WriteNestedFolder(writer, solution.Guid, projectGuid); - } - - private static void WriteNestedFolder(StreamWriter writer, Guid parentGuid, Guid childGuid) - { - writer.WriteLine("\t\t{0} = {1}", - childGuid.ToString("B").ToUpper(), - parentGuid.ToString("B").ToUpper()); - } - - private static void WriteConfigurationLines(ICollection configurations, SolutionNode solution, StreamWriter ss) - { - foreach (ProjectNode project in solution.Projects) - { - foreach (ConfigurationNode conf in configurations) - { - ss.WriteLine("\t\t{0}.{1}|Any CPU.ActiveCfg = {1}|Any CPU", - project.Guid.ToString("B").ToUpper(), - conf.Name); - - ss.WriteLine("\t\t{0}.{1}|Any CPU.Build.0 = {1}|Any CPU", - project.Guid.ToString("B").ToUpper(), - conf.Name); - } - } - - foreach (SolutionNode child in solution.Solutions) - { - WriteConfigurationLines(configurations, child, ss); - } - } - - private void WriteSolutionFiles(SolutionNode solution, StreamWriter ss) - { - if (solution.Files != null && solution.Files.Count > 0) - WriteProject(ss, "Folder", solution.Guid, "Solution Files", "Solution Files", solution.Files); - } - - private void WriteEmbeddedSolution(StreamWriter writer, SolutionNode embeddedSolution) - { - WriteProject(writer, "Folder", embeddedSolution.Guid, embeddedSolution.Name, embeddedSolution.Name, embeddedSolution.Files); - } - - private void WriteProject(SolutionNode solution, StreamWriter ss, ProjectNode project) - { - WriteProject(ss, solution, project.Language, project.Guid, project.Name, project.FullPath); - } - - private void WriteProject(SolutionNode solution, StreamWriter ss, DatabaseProjectNode dbProject) - { - if (solution.Files != null && solution.Files.Count > 0) - WriteProject(ss, solution, "Database", dbProject.Guid, dbProject.Name, dbProject.FullPath); - } - - const string ProjectDeclarationBeginFormat = "Project(\"{0}\") = \"{1}\", \"{2}\", \"{3}\""; - const string ProjectDeclarationEndFormat = "EndProject"; - - private void WriteProject(StreamWriter ss, SolutionNode solution, string language, Guid guid, string name, string projectFullPath) - { - if (!tools.ContainsKey(language)) - throw new UnknownLanguageException("Unknown .NET language: " + language); - - ToolInfo toolInfo = (ToolInfo)tools[language]; - - string path = Helper.MakePathRelativeTo(solution.FullPath, projectFullPath); - - path = Helper.MakeFilePath(path, name, toolInfo.FileExtension); - - WriteProject(ss, language, guid, name, path); - } - - private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location) - { - WriteProject(writer, language, projectGuid, name, location, null); - } - - private void WriteProject(StreamWriter writer, string language, Guid projectGuid, string name, string location, FilesNode files) - { - if (!tools.ContainsKey(language)) - throw new UnknownLanguageException("Unknown .NET language: " + language); - - ToolInfo toolInfo = (ToolInfo)tools[language]; - - writer.WriteLine(ProjectDeclarationBeginFormat, - toolInfo.Guid, - name, - location, - projectGuid.ToString("B").ToUpper()); - - if (files != null) - { - writer.WriteLine("\tProjectSection(SolutionItems) = preProject"); - - foreach (string file in files) - writer.WriteLine("\t\t{0} = {0}", file); - - writer.WriteLine("\tEndProjectSection"); - } - - writer.WriteLine(ProjectDeclarationEndFormat); - } - - private void WriteDatabaseProject(SolutionNode solution, DatabaseProjectNode project) - { - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, "dbp"); - IndentedTextWriter ps = new IndentedTextWriter(new StreamWriter(projectFile), " "); - - kernel.CurrentWorkingDirectory.Push(); - - Helper.SetCurrentDir(Path.GetDirectoryName(projectFile)); - - using (ps) - { - ps.WriteLine("# Microsoft Developer Studio Project File - Database Project"); - ps.WriteLine("Begin DataProject = \"{0}\"", project.Name); - ps.Indent++; - ps.WriteLine("MSDTVersion = \"80\""); - // TODO: Use the project.Files property - if (ContainsSqlFiles(Path.GetDirectoryName(projectFile))) - WriteDatabaseFoldersAndFiles(ps, Path.GetDirectoryName(projectFile)); - - ps.WriteLine("Begin DBRefFolder = \"Database References\""); - ps.Indent++; - foreach (DatabaseReferenceNode reference in project.References) - { - ps.WriteLine("Begin DBRefNode = \"{0}\"", reference.Name); - ps.Indent++; - ps.WriteLine("ConnectStr = \"{0}\"", reference.ConnectionString); - ps.WriteLine("Provider = \"{0}\"", reference.ProviderId.ToString("B").ToUpper()); - //ps.WriteLine("Colorizer = 5"); - ps.Indent--; - ps.WriteLine("End"); - } - ps.Indent--; - ps.WriteLine("End"); - ps.Indent--; - ps.WriteLine("End"); - - ps.Flush(); - } - - kernel.CurrentWorkingDirectory.Pop(); - } - - private bool ContainsSqlFiles(string folder) - { - foreach (string file in Directory.GetFiles(folder, "*.sql")) - { - return true; // if the folder contains 1 .sql file, that's good enough - } - - foreach (string child in Directory.GetDirectories(folder)) - { - if (ContainsSqlFiles(child)) - return true; // if 1 child folder contains a .sql file, still good enough - } - - return false; - } - - private void WriteDatabaseFoldersAndFiles(IndentedTextWriter writer, string folder) - { - foreach (string child in Directory.GetDirectories(folder)) - { - if (ContainsSqlFiles(child)) - { - writer.WriteLine("Begin Folder = \"{0}\"", Path.GetFileName(child)); - writer.Indent++; - WriteDatabaseFoldersAndFiles(writer, child); - writer.Indent--; - writer.WriteLine("End"); - } - } - foreach (string file in Directory.GetFiles(folder, "*.sql")) - { - writer.WriteLine("Script = \"{0}\"", Path.GetFileName(file)); - } - } - - private void CleanProject(ProjectNode project) - { - kernel.Log.Write("...Cleaning project: {0}", project.Name); - - ToolInfo toolInfo = (ToolInfo)tools[project.Language]; - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension); - string userFile = projectFile + ".user"; - - Helper.DeleteIfExists(projectFile); - Helper.DeleteIfExists(userFile); - } - - private void CleanSolution(SolutionNode solution) - { - kernel.Log.Write("Cleaning {0} solution and project files", this.VersionName, solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "sln"); - string suoFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "suo"); - - Helper.DeleteIfExists(slnFile); - Helper.DeleteIfExists(suoFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public virtual void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - WriteSolution(sol, true); - } - kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - kernel = kern; - foreach (SolutionNode sol in kernel.Solutions) - { - CleanSolution(sol); - } - kernel = null; - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Targets/VSVersion.cs b/Programs/Prebuild/src/Core/Targets/VSVersion.cs deleted file mode 100644 index ff303d6c..00000000 --- a/Programs/Prebuild/src/Core/Targets/VSVersion.cs +++ /dev/null @@ -1,67 +0,0 @@ -#region BSD License -/* -Copyright (c) 2008-2009 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com), John Anderson (sontek@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: (local) $ - * $Date: 2008-04-16 16:32:42 -0600 (Wed, 16 Apr 2008) $ - * $Revision: 177M $ - */ -#endregion - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - public enum VSVersion - { - /// - /// Visual Studio 2002 - /// - VS70, - /// - /// Visual Studio 2003 - /// - VS71, - /// - /// Visual Studio 2005 - /// - VS80, - /// - /// Visual Studio 2008 - /// - VS90, - /// - /// Visual Studio 2010 - /// - VS10, - /// - /// Visual Studio 2012 - /// - VS11, - } -} diff --git a/Programs/Prebuild/src/Core/Targets/XcodeTarget.cs b/Programs/Prebuild/src/Core/Targets/XcodeTarget.cs deleted file mode 100644 index 513c4bd3..00000000 --- a/Programs/Prebuild/src/Core/Targets/XcodeTarget.cs +++ /dev/null @@ -1,605 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2007-02-13 12:58:03 -0800 (Tue, 13 Feb 2007) $ - * $Revision: 205 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Text.RegularExpressions; - -using Prebuild.Core.Attributes; -using Prebuild.Core.Interfaces; -using Prebuild.Core.Nodes; -using Prebuild.Core.Utilities; - -namespace Prebuild.Core.Targets -{ - /// - /// - /// - [Target("xcode")] - public class XcodeTarget : ITarget - { - #region Fields - - private Kernel m_Kernel; - - #endregion - - #region Private Methods - - private static string PrependPath(string path) - { - string tmpPath = Helper.NormalizePath(path, '/'); - Regex regex = new Regex(@"(\w):/(\w+)"); - Match match = regex.Match(tmpPath); - //if(match.Success || tmpPath[0] == '.' || tmpPath[0] == '/') - //{ - tmpPath = Helper.NormalizePath(tmpPath); - //} - // else - // { - // tmpPath = Helper.NormalizePath("./" + tmpPath); - // } - - return tmpPath; - } - - private static string BuildReference(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - string fileRef = FindFileReference(refr.Name, project); - string finalPath = Helper.NormalizePath(Helper.MakeFilePath(project.FullPath + "/${build.dir}/", refr.Name, "dll"), '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if (refr.Path != null || fileRef != null) - { - string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path + "/" + refr.Name + ".dll", '/') : fileRef; - ret += finalPath; - return ret; - } - - try - { - //Assembly assem = Assembly.Load(refr.Name); - //if (assem != null) - //{ - //ret += (refr.Name + ".dll"); - //} - //else - //{ - ret += (refr.Name + ".dll"); - //} - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += refr.Name + ".dll"; - } - } - return ret; - } - - private static string BuildReferencePath(SolutionNode solution, ReferenceNode refr) - { - string ret = ""; - if (solution.ProjectsTable.ContainsKey(refr.Name)) - { - ProjectNode project = (ProjectNode)solution.ProjectsTable[refr.Name]; - string fileRef = FindFileReference(refr.Name, project); - string finalPath = Helper.NormalizePath(Helper.MakeReferencePath(project.FullPath + "/${build.dir}/"), '/'); - ret += finalPath; - return ret; - } - else - { - ProjectNode project = (ProjectNode)refr.Parent; - string fileRef = FindFileReference(refr.Name, project); - - if (refr.Path != null || fileRef != null) - { - string finalPath = (refr.Path != null) ? Helper.NormalizePath(refr.Path, '/') : fileRef; - ret += finalPath; - return ret; - } - - try - { - Assembly assem = Assembly.Load(refr.Name); - if (assem != null) - { - ret += ""; - } - else - { - ret += ""; - } - } - catch (System.NullReferenceException e) - { - e.ToString(); - ret += ""; - } - } - return ret; - } - - private static string FindFileReference(string refName, ProjectNode project) - { - foreach (ReferencePathNode refPath in project.ReferencePaths) - { - string fullPath = Helper.MakeFilePath(refPath.Path, refName, "dll"); - - if (File.Exists(fullPath)) - { - return fullPath; - } - } - - return null; - } - - /// - /// Gets the XML doc file. - /// - /// The project. - /// The conf. - /// - public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf) - { - if (conf == null) - { - throw new ArgumentNullException("conf"); - } - if (project == null) - { - throw new ArgumentNullException("project"); - } - string docFile = (string)conf.Options["XmlDocFile"]; - // if(docFile != null && docFile.Length == 0)//default to assembly name if not specified - // { - // return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml"; - // } - return docFile; - } - - private void WriteProject(SolutionNode solution, ProjectNode project) - { - string projFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); - StreamWriter ss = new StreamWriter(projFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(projFile)); - bool hasDoc = false; - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", project.Name); - ss.WriteLine(" ", "build"); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - if (refr.LocalCopy) - { - ss.WriteLine(" ", '/')); - } - } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.Write(" "); - ss.WriteLine(" ", project.RootNamespace); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.EmbeddedResource: - ss.WriteLine(" {0}", ""); - break; - default: - if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings) - { - ss.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - } - break; - } - } - //if (project.Files.GetSubType(file).ToString() != "Code") - //{ - // ps.WriteLine(" ", file.Substring(0, file.LastIndexOf('.')) + ".resx"); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (string file in project.Files) - { - switch (project.Files.GetBuildAction(file)) - { - case BuildAction.Compile: - ss.WriteLine(" "); - break; - default: - break; - } - } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ReferenceNode refr in project.References) - { - ss.WriteLine(" ", '/')); - } - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - ss.WriteLine(" "); - if (hasDoc) - { - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.Write(" "); - } - else - { - ss.WriteLine(".exe\" />"); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - // foreach(ReferenceNode refr in project.References) - // { - // string path = Helper.NormalizePath(Helper.MakePathRelativeTo(project.FullPath, BuildReferencePath(solution, refr)), '/'); - // if (path != "") - // { - // ss.WriteLine(" ", path); - // } - // } - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - } - ss.WriteLine(" "); - ss.WriteLine(""); - } - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void WriteCombine(SolutionNode solution) - { - m_Kernel.Log.Write("Creating Xcode build files"); - foreach (ProjectNode project in solution.Projects) - { - if (m_Kernel.AllowProject(project.FilterGroups)) - { - m_Kernel.Log.Write("...Creating project: {0}", project.Name); - WriteProject(solution, project); - } - } - - m_Kernel.Log.Write(""); - DirectoryInfo directoryInfo = new DirectoryInfo(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj")); - if (!directoryInfo.Exists) - { - directoryInfo.Create(); - } - string combFile = Helper.MakeFilePath(Path.Combine(solution.FullPath, solution.Name + ".xcodeproj"), "project", "pbxproj"); - StreamWriter ss = new StreamWriter(combFile); - - m_Kernel.CurrentWorkingDirectory.Push(); - Helper.SetCurrentDir(Path.GetDirectoryName(combFile)); - - using (ss) - { - ss.WriteLine(""); - ss.WriteLine("", solution.Name); - ss.WriteLine(" "); - ss.WriteLine(); - - //ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - - foreach (ConfigurationNode conf in solution.Configurations) - { - // Set the project.config to a non-debug configuration - if (conf.Options["DebugInformation"].ToString().ToLower() != "true") - { - ss.WriteLine(" ", conf.Name); - } - ss.WriteLine(); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Name); - ss.WriteLine(" ", conf.Options["DebugInformation"].ToString().ToLower()); - ss.WriteLine(" "); - ss.WriteLine(); - } - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(" "); - //foreach(ProjectNode project in solution.Projects) - //{ - // string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - // ss.Write(" "); - //} - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - - foreach (ProjectNode project in solution.ProjectsTableOrder) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(" "); - ss.WriteLine(); - //ss.WriteLine(" "); - ss.WriteLine(" "); - ss.WriteLine(); - - ss.WriteLine(" "); - ss.WriteLine(" "); - foreach (ProjectNode project in solution.Projects) - { - string path = Helper.MakePathRelativeTo(solution.FullPath, project.FullPath); - ss.Write(" "); - } - ss.WriteLine(" "); - ss.WriteLine(); - ss.WriteLine(""); - } - - m_Kernel.CurrentWorkingDirectory.Pop(); - } - - private void CleanProject(ProjectNode project) - { - m_Kernel.Log.Write("...Cleaning project: {0}", project.Name); - string projectFile = Helper.MakeFilePath(project.FullPath, project.Name + (project.Type == ProjectType.Library ? ".dll" : ".exe"), "build"); - Helper.DeleteIfExists(projectFile); - } - - private void CleanSolution(SolutionNode solution) - { - m_Kernel.Log.Write("Cleaning Xcode build files for", solution.Name); - - string slnFile = Helper.MakeFilePath(solution.FullPath, solution.Name, "build"); - Helper.DeleteIfExists(slnFile); - - foreach (ProjectNode project in solution.Projects) - { - CleanProject(project); - } - - m_Kernel.Log.Write(""); - } - - #endregion - - #region ITarget Members - - /// - /// Writes the specified kern. - /// - /// The kern. - public void Write(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode solution in kern.Solutions) - { - WriteCombine(solution); - } - m_Kernel = null; - } - - /// - /// Cleans the specified kern. - /// - /// The kern. - public virtual void Clean(Kernel kern) - { - if (kern == null) - { - throw new ArgumentNullException("kern"); - } - m_Kernel = kern; - foreach (SolutionNode sol in kern.Solutions) - { - CleanSolution(sol); - } - m_Kernel = null; - } - - /// - /// Gets the name. - /// - /// The name. - public string Name - { - get - { - return "xcode"; - } - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/UnknownLanguageException.cs b/Programs/Prebuild/src/Core/UnknownLanguageException.cs deleted file mode 100644 index cbd1dc1b..00000000 --- a/Programs/Prebuild/src/Core/UnknownLanguageException.cs +++ /dev/null @@ -1,63 +0,0 @@ -/* - * $RCSfile$ - * Copyright (C) 2004, 2005 David Hudson (jendave@yahoo.com) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -using System; -using System.Runtime.Serialization; - -namespace Prebuild.Core -{ - /// - /// - [Serializable()] - public class UnknownLanguageException : Exception - { - /// - /// Basic exception. - /// - public UnknownLanguageException() - { - } - - /// - /// Exception with specified string - /// - /// Exception message - public UnknownLanguageException(string message): base(message) - { - } - - /// - /// - /// - /// - /// - public UnknownLanguageException(string message, Exception exception) : base(message, exception) - { - } - - /// - /// - /// - /// - /// - protected UnknownLanguageException(SerializationInfo info, StreamingContext context) : base( info, context ) - { - } - } -} diff --git a/Programs/Prebuild/src/Core/Utilities/CommandLineCollection.cs b/Programs/Prebuild/src/Core/Utilities/CommandLineCollection.cs deleted file mode 100644 index 67ae6b0d..00000000 --- a/Programs/Prebuild/src/Core/Utilities/CommandLineCollection.cs +++ /dev/null @@ -1,162 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: robloach $ - * $Date: 2006-09-25 15:30:53 -0700 (Mon, 25 Sep 2006) $ - * $Revision: 165 $ - */ -#endregion - -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Diagnostics; - -namespace Prebuild.Core.Utilities -{ - /// - /// The CommandLine class parses and interprets the command-line arguments passed to - /// prebuild. - /// - public class CommandLineCollection - { - #region Fields - - // The raw OS arguments - private string[] m_RawArgs; - - // Command-line argument storage - private Hashtable m_Arguments; - - #endregion - - #region Constructors - - /// - /// Create a new CommandLine instance and set some internal variables. - /// - public CommandLineCollection(string[] args) - { - m_RawArgs = args; - m_Arguments = new Hashtable(); - - Parse(); - } - - #endregion - - #region Private Methods - - private void Parse() - { - if(m_RawArgs.Length < 1) - return; - - int idx = 0; - string arg = null, lastArg = null; - - while(idx 2 && arg[0] == '/') - { - arg = arg.Substring(1); - lastArg = arg; - m_Arguments[arg] = ""; - } - else - { - if(lastArg != null) - { - m_Arguments[lastArg] = arg; - lastArg = null; - } - } - - idx++; - } - } - - #endregion - - #region Public Methods - - /// - /// Wases the passed. - /// - /// The arg. - /// - public bool WasPassed(string arg) - { - return (m_Arguments.ContainsKey(arg)); - } - - #endregion - - #region Properties - - /// - /// Gets the parameter associated with the command line option - /// - /// Returns null if option was not specified, - /// null string if no parameter was specified, and the value if a parameter was specified - public string this[string index] - { - get - { - if(m_Arguments.ContainsKey(index)) - { - return (string)(m_Arguments[index]); - } - else - { - return null; - } - } - } - - #endregion - - #region IEnumerable Members - - /// - /// Returns an enumerator that can iterate through a collection. - /// - /// - /// An - /// that can be used to iterate through the collection. - /// - public IDictionaryEnumerator GetEnumerator() - { - return m_Arguments.GetEnumerator(); - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Utilities/CurrentDirectory.cs b/Programs/Prebuild/src/Core/Utilities/CurrentDirectory.cs deleted file mode 100644 index f8af4ff7..00000000 --- a/Programs/Prebuild/src/Core/Utilities/CurrentDirectory.cs +++ /dev/null @@ -1,89 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; -using System.Collections; - -namespace Prebuild.Core.Utilities -{ - /// - /// - /// - public class CurrentDirectory - { - #region Fields - - private Stack m_Stack; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - public CurrentDirectory() - { - m_Stack = new Stack(); - } - - #endregion - - #region Public Methods - - /// - /// Pushes this instance. - /// - public void Push() - { - m_Stack.Push(Environment.CurrentDirectory); - } - - /// - /// Pops this instance. - /// - public void Pop() - { - if(m_Stack.Count < 1) - { - return; - } - - string cwd = (string)m_Stack.Pop(); - Helper.SetCurrentDir(cwd); - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Utilities/Helper.cs b/Programs/Prebuild/src/Core/Utilities/Helper.cs deleted file mode 100644 index cd778ddc..00000000 --- a/Programs/Prebuild/src/Core/Utilities/Helper.cs +++ /dev/null @@ -1,663 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: sontek $ - * $Date: 2008-04-29 15:51:17 -0700 (Tue, 29 Apr 2008) $ - * $Revision: 264 $ - */ -#endregion - -using System; -using System.Collections; -using System.Diagnostics; -using System.IO; -using System.Runtime.InteropServices; -using System.Text.RegularExpressions; -using System.Collections.Specialized; -using System.Xml; -using Prebuild.Core.Nodes; - -namespace Prebuild.Core.Utilities -{ - /// - /// - /// - public class Helper - { - #region Fields - - private static Stack dirStack; - private static Regex varRegex; - static bool checkForOSVariables; - - /// - /// - /// - public static bool CheckForOSVariables - { - get - { - return checkForOSVariables; - } - set - { - checkForOSVariables = value; - } - } - - #endregion - - #region Constructors - - /// - /// Initializes the class. - /// - static Helper() - { - dirStack = new Stack(); - //m_VarRegex = new Regex(@"\${(?[\w|_]+)}"); - } - - #endregion - - #region Properties - - /// - /// - /// - public static Stack DirStack - { - get - { - return dirStack; - } - } - - /// - /// - /// - public static Regex VarRegex - { - get - { - return varRegex; - } - set - { - varRegex = value; - } - } - - #endregion - - #region Public Methods - - #region String Parsing - #region Inner Classes and Delegates - /// - /// - /// - public delegate string StringLookup(string key); - - #endregion - - /// - /// Gets a collection of StringLocationPair objects that represent the matches - /// - /// The target. - /// The before group. - /// The after group. - /// if set to true [include delimiters in substrings]. - /// - public static StringCollection FindGroups(string target, string beforeGroup, string afterGroup, bool includeDelimitersInSubstrings) - { - if( beforeGroup == null ) - { - throw new ArgumentNullException("beforeGroup"); - } - if( afterGroup == null ) - { - throw new ArgumentNullException("afterGroup"); - } - StringCollection results = new StringCollection(); - if(target == null || target.Length == 0) - { - return results; - } - - int beforeMod = 0; - int afterMod = 0; - if(includeDelimitersInSubstrings) - { - //be sure to not exlude the delims - beforeMod = beforeGroup.Length; - afterMod = afterGroup.Length; - } - int startIndex = 0; - while((startIndex = target.IndexOf(beforeGroup,startIndex)) != -1) { - int endIndex = target.IndexOf(afterGroup,startIndex);//the index of the char after it - if(endIndex == -1) - { - break; - } - int length = endIndex - startIndex - beforeGroup.Length;//move to the first char in the string - string substring = substring = target.Substring(startIndex + beforeGroup.Length - beforeMod, - length - afterMod); - - results.Add(substring); - //results.Add(new StringLocationPair(substring,startIndex)); - startIndex = endIndex + 1; - //the Interpolate*() methods will not work if expressions are expandded inside expression due to an optimization - //so start after endIndex - - } - return results; - } - - /// - /// Replaces the groups. - /// - /// The target. - /// The before group. - /// The after group. - /// The lookup. - /// - public static string ReplaceGroups(string target, string beforeGroup, string afterGroup, StringLookup lookup) { - if( target == null ) - { - throw new ArgumentNullException("target"); - } - //int targetLength = target.Length; - StringCollection strings = FindGroups(target,beforeGroup,afterGroup,false); - if( lookup == null ) - { - throw new ArgumentNullException("lookup"); - } - foreach(string substring in strings) - { - target = target.Replace(beforeGroup + substring + afterGroup, lookup(substring) ); - } - return target; - } - - /// - /// Replaces ${var} statements in a string with the corresonding values as detirmined by the lookup delegate - /// - /// The target. - /// The lookup. - /// - public static string InterpolateForVariables(string target, StringLookup lookup) - { - return ReplaceGroups(target, "${" , "}" , lookup); - } - - /// - /// Replaces ${var} statements in a string with the corresonding environment variable with name var - /// - /// - /// - public static string InterpolateForEnvironmentVariables(string target) - { - return InterpolateForVariables(target, new StringLookup(Environment.GetEnvironmentVariable)); - } - - #endregion - - /// - /// Translates the value. - /// - /// Type of the translate. - /// The translation item. - /// - public static object TranslateValue(Type translateType, string translationItem) - { - if(translationItem == null) - { - return null; - } - - try - { - string lowerVal = translationItem.ToLower(); - if(translateType == typeof(bool)) - { - return (lowerVal == "true" || lowerVal == "1" || lowerVal == "y" || lowerVal == "yes" || lowerVal == "on"); - } - else if(translateType == typeof(int)) - { - return (Int32.Parse(translationItem)); - } - else - { - return translationItem; - } - } - catch(FormatException) - { - return null; - } - } - - /// - /// Deletes if exists. - /// - /// The file. - /// - public static bool DeleteIfExists(string file) - { - string resFile = null; - try - { - resFile = ResolvePath(file); - } - catch(ArgumentException) - { - return false; - } - - if(!File.Exists(resFile)) - { - return false; - } - - File.Delete(resFile); - return true; - } - - static readonly char seperator = Path.DirectorySeparatorChar; - - // This little gem was taken from the NeL source, thanks guys! - /// - /// Makes a relative path - /// - /// Path to start from - /// Path to end at - /// Path that will get from startPath to endPath - public static string MakePathRelativeTo(string startPath, string endPath) - { - string tmp = NormalizePath(startPath, seperator); - string src = NormalizePath(endPath, seperator); - string prefix = ""; - - while(true) - { - if((String.Compare(tmp, 0, src, 0, tmp.Length) == 0)) - { - string ret; - int size = tmp.Length; - if(size == src.Length) - { - return "./"; - } - if((src.Length > tmp.Length) && src[tmp.Length - 1] != seperator) - { - } - else - { - ret = prefix + endPath.Substring(size, endPath.Length - size); - ret = ret.Trim(); - if(ret[0] == seperator) - { - ret = "." + ret; - } - - return NormalizePath(ret); - } - - } - - if(tmp.Length < 2) - { - break; - } - - int lastPos = tmp.LastIndexOf(seperator, tmp.Length - 2); - int prevPos = tmp.IndexOf(seperator); - - if((lastPos == prevPos) || (lastPos == -1)) - { - break; - } - - tmp = tmp.Substring(0, lastPos + 1); - prefix += ".." + seperator.ToString(); - } - - return endPath; - } - - /// - /// Resolves the path. - /// - /// The path. - /// - public static string ResolvePath(string path) - { - string tmpPath = NormalizePath(path); - if(tmpPath.Length < 1) - { - tmpPath = "."; - } - - tmpPath = Path.GetFullPath(tmpPath); - if(!File.Exists(tmpPath) && !Directory.Exists(tmpPath)) - { - throw new ArgumentException("Path could not be resolved: " + tmpPath); - } - - return tmpPath; - } - - /// - /// Normalizes the path. - /// - /// The path. - /// The separator character. - /// - public static string NormalizePath(string path, char separatorCharacter) - { - if(path == null || path == "" || path.Length < 1) - { - return ""; - } - - string tmpPath = path.Replace('\\', '/'); - tmpPath = tmpPath.Replace('/', separatorCharacter); - return tmpPath; - } - - /// - /// Normalizes the path. - /// - /// The path. - /// - public static string NormalizePath(string path) - { - return NormalizePath(path, Path.DirectorySeparatorChar); - } - - /// - /// Ends the path. - /// - /// The path. - /// The separator character. - /// - public static string EndPath(string path, char separatorCharacter) - { - if(path == null || path == "" || path.Length < 1) - { - return ""; - } - - if(!path.EndsWith(separatorCharacter.ToString())) - { - return (path + separatorCharacter); - } - - return path; - } - - /// - /// Ends the path. - /// - /// The path. - /// - public static string EndPath(string path) - { - return EndPath(path, Path.DirectorySeparatorChar); - } - - /// - /// Makes the file path. - /// - /// The path. - /// The name. - /// The ext. - /// - public static string MakeFilePath(string path, string name, string ext) - { - string ret = EndPath(NormalizePath(path)); - - if( name == null ) - { - throw new ArgumentNullException("name"); - } - - ret += name; - if(!name.EndsWith("." + ext)) - { - ret += "." + ext; - } - - foreach(char c in Path.GetInvalidPathChars()) - { - ret = ret.Replace(c, '_'); - } - - return ret; - } - - /// - /// Makes the file path. - /// - /// The path. - /// The name. - /// - public static string MakeFilePath(string path, string name) - { - string ret = EndPath(NormalizePath(path)); - - if( name == null ) - { - throw new ArgumentNullException("name"); - } - - ret += name; - - foreach (char c in Path.GetInvalidPathChars()) - { - ret = ret.Replace(c, '_'); - } - - return ret; - } - - /// - /// - /// - /// - /// - public static string MakeReferencePath(string path) - { - string ret = EndPath(NormalizePath(path)); - - foreach (char c in Path.GetInvalidPathChars()) - { - ret = ret.Replace(c, '_'); - } - - return ret; - } - - /// - /// Sets the current dir. - /// - /// The path. - public static void SetCurrentDir(string path) - { - if( path == null ) - { - throw new ArgumentNullException("path"); - } - if(path.Length < 1) - { - return; - } - - Environment.CurrentDirectory = path; - } - - /// - /// Checks the type. - /// - /// The type to check. - /// The attr. - /// The inter. - /// - public static object CheckType(Type typeToCheck, Type attr, Type inter) - { - if(typeToCheck == null || attr == null) - { - return null; - } - - object[] attrs = typeToCheck.GetCustomAttributes(attr, false); - if(attrs == null || attrs.Length < 1) - { - return null; - } - if( inter == null ) - { - throw new ArgumentNullException("inter"); - } - - if(typeToCheck.GetInterface(inter.FullName) == null) - { - return null; - } - - return attrs[0]; - } - - /* A bit of overhead for simple group parsing, there are problems with Regex in Mono - public static string ParseValue(string val) - { - if(val == null || val.Length < 1 || !CheckForOSVariables) - return val; - - string tmp = val; - Match m = m_VarRegex.Match(val); - while(m.Success) - { - if(m.Groups["var"] == null) - continue; - - Capture c = m.Groups["var"].Captures[0]; - if(c == null) - continue; - - string var = c.Value; - string envVal = Environment.GetEnvironmentVariable(var); - if(envVal == null) - envVal = ""; - - tmp = tmp.Replace("${" + var + "}", envVal); - m = m.NextMatch(); - } - - return tmp; - }*/ - - /// - /// Attributes the value. - /// - /// The node. - /// The attr. - /// The def. - /// - public static string AttributeValue(XmlNode node, string attr, string def) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - if(node.Attributes[attr] == null) - { - return def; - } - string val = node.Attributes[attr].Value; - if(!CheckForOSVariables) - { - return val; - } - - return InterpolateForEnvironmentVariables(val); - } - - /// - /// Parses the boolean. - /// - /// The node. - /// The attr. - /// if set to true [default value]. - /// - public static bool ParseBoolean(XmlNode node, string attr, bool defaultValue) - { - if( node == null ) - { - throw new ArgumentNullException("node"); - } - if(node.Attributes[attr] == null) - { - return defaultValue; - } - return bool.Parse(node.Attributes[attr].Value); - } - - /// - /// Enums the attribute value. - /// - /// The node. - /// The attr. - /// Type of the enum. - /// The def. - /// - public static object EnumAttributeValue(XmlNode node, string attr, Type enumType, object def) - { - if( def == null ) - { - throw new ArgumentNullException("def"); - } - string val = AttributeValue(node, attr, def.ToString()); - return Enum.Parse(enumType, val, true); - } - - /// - /// - /// - /// - /// - /// - public static string AssemblyFullName(string assemblyName, ProjectType projectType) - { - return assemblyName + (projectType == ProjectType.Library ? ".dll" : ".exe"); - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/Utilities/Log.cs b/Programs/Prebuild/src/Core/Utilities/Log.cs deleted file mode 100644 index aafa0f2b..00000000 --- a/Programs/Prebuild/src/Core/Utilities/Log.cs +++ /dev/null @@ -1,279 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-01-27 16:49:58 -0800 (Fri, 27 Jan 2006) $ - * $Revision: 71 $ - */ -#endregion - -using System; -using System.IO; - -namespace Prebuild.Core.Utilities -{ - /// - /// - /// - public enum LogType - { - /// - /// - /// - None, - /// - /// - /// - Info, - /// - /// - /// - Warning, - /// - /// - /// - Error - } - - /// - /// - /// - [Flags] - public enum LogTargets - { - /// - /// - /// - None = 0, - /// - /// - /// - Null = 1, - /// - /// - /// - File = 2, - /// - /// - /// - Console = 4 - } - - /// - /// Summary description for Log. - /// - public class Log : IDisposable - { - #region Fields - - private StreamWriter m_Writer; - private LogTargets m_Target = LogTargets.Null; - bool disposed; - - #endregion - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// The target. - /// Name of the file. - public Log(LogTargets target, string fileName) - { - m_Target = target; - - if((m_Target & LogTargets.File) != 0) - { - m_Writer = new StreamWriter(fileName, false); - } - } - - #endregion - - #region Public Methods - - /// - /// Writes this instance. - /// - public void Write() - { - Write(string.Empty); - } - - /// - /// Writes the specified MSG. - /// - /// The MSG. - public void Write(string msg) - { - if((m_Target & LogTargets.Null) != 0) - { - return; - } - - if((m_Target & LogTargets.Console) != 0) - { - Console.WriteLine(msg); - } - if((m_Target & LogTargets.File) != 0 && m_Writer != null) - { - m_Writer.WriteLine(msg); - } - } - - /// - /// Writes the specified format. - /// - /// The format. - /// The args. - public void Write(string format, params object[] args) - { - Write(string.Format(format,args)); - } - - /// - /// Writes the specified type. - /// - /// The type. - /// The format. - /// The args. - public void Write(LogType type, string format, params object[] args) - { - if((m_Target & LogTargets.Null) != 0) - { - return; - } - - string str = ""; - switch(type) - { - case LogType.Info: - str = "[I] "; - break; - case LogType.Warning: - str = "[!] "; - break; - case LogType.Error: - str = "[X] "; - break; - } - - Write(str + format,args); - } - - /// - /// Writes the exception. - /// - /// The type. - /// The ex. - public void WriteException(LogType type, Exception ex) - { - if(ex != null) - { - Write(type, ex.Message); - //#if DEBUG - m_Writer.WriteLine("Exception @{0} stack trace [[", ex.TargetSite.Name); - m_Writer.WriteLine(ex.StackTrace); - m_Writer.WriteLine("]]"); - //#endif - } - } - - /// - /// Flushes this instance. - /// - public void Flush() - { - if(m_Writer != null) - { - m_Writer.Flush(); - } - } - - #endregion - - #region IDisposable Members - - /// - /// Performs application-defined tasks associated with freeing, releasing, or - /// resetting unmanaged resources. - /// - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - /// - /// Dispose objects - /// - /// - /// If true, it will dispose close the handle - /// - /// - /// Will dispose managed and unmanaged resources. - /// - protected virtual void Dispose(bool disposing) - { - if (!this.disposed) - { - if (disposing) - { - if (m_Writer != null) - { - m_Writer.Close(); - m_Writer = null; - } - } - } - this.disposed = true; - } - - /// - /// - /// - ~Log() - { - this.Dispose(false); - } - - /// - /// Closes and destroys this object - /// - /// - /// Same as Dispose(true) - /// - public void Close() - { - Dispose(); - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Core/WarningException.cs b/Programs/Prebuild/src/Core/WarningException.cs deleted file mode 100644 index 3c4556cd..00000000 --- a/Programs/Prebuild/src/Core/WarningException.cs +++ /dev/null @@ -1,84 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -using System; -using System.Runtime.Serialization; - -namespace Prebuild.Core -{ - /// - /// - /// - [Serializable()] - public class WarningException : Exception - { - #region Constructors - - /// - /// - /// - public WarningException() - { - } - - /// - /// - /// - /// - /// - public WarningException(string format, params object[] args) - : base(String.Format(format, args)) - { - } - - /// - /// Exception with specified string - /// - /// Exception message - public WarningException(string message): base(message) - { - } - - /// - /// - /// - /// - /// - public WarningException(string message, Exception exception) : base(message, exception) - { - } - - /// - /// - /// - /// - /// - protected WarningException(SerializationInfo info, StreamingContext context) : base( info, context ) - { - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Prebuild.cs b/Programs/Prebuild/src/Prebuild.cs deleted file mode 100644 index 315f8b7a..00000000 --- a/Programs/Prebuild/src/Prebuild.cs +++ /dev/null @@ -1,165 +0,0 @@ -#region BSD License -/* -Copyright (c) 2004-2005 Matthew Holmes (matthew@wildfiregames.com), Dan Moorehead (dan05a@gmail.com) - -Redistribution and use in source and binary forms, with or without modification, are permitted -provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. -* The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: jendave $ - * $Date: 2006-09-26 14:43:35 -0700 (Tue, 26 Sep 2006) $ - * $Revision: 168 $ - */ -#endregion - -using System; -using System.Collections.Specialized; -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; -using System.EnterpriseServices.Internal; - -using Prebuild.Core; -using Prebuild.Core.Utilities; - -namespace Prebuild -{ - /// - /// - /// - class Prebuild - { - #region Main - - [STAThread] - static void Main(string[] args) - { - Kernel kernel = null; - try - { - kernel = Kernel.Instance; - kernel.Initialize(LogTargets.File | LogTargets.Console, args); - bool exit = false; - - if(kernel.CommandLine.WasPassed("usage")) - { - exit = true; - OutputUsage(); - } - if(kernel.CommandLine.WasPassed("showtargets")) - { - exit = true; - OutputTargets(kernel); - } - if(kernel.CommandLine.WasPassed("install")) - { - exit = true; - InstallAssembly(kernel); - } - if(kernel.CommandLine.WasPassed("remove")) - { - exit = true; - RemoveAssembly(kernel); - } - - if(!exit) - { - kernel.Process(); - } - } - catch(Exception ex) - { - Console.WriteLine("Unhandled error: {0}", ex.Message); - //#if DEBUG - Console.WriteLine("{0}", ex.StackTrace); - //#endif - } - finally - { - if(kernel.PauseAfterFinish) - { - Console.WriteLine("\nPress enter to continue..."); - Console.ReadLine(); - } - } - } - - #endregion - - #region Private Methods - - private static void InstallAssembly(Kernel kernel) - { - Publish publish = new Publish(); - string file = kernel.CommandLine["install"]; - //Console.WriteLine(".."+file+".."); - publish.GacInstall(file); - } - - private static void RemoveAssembly(Kernel kernel) - { - Publish publish = new Publish(); - string file = kernel.CommandLine["remove"]; - publish.GacRemove(file); - } - - private static void OutputUsage() - { - Console.WriteLine("Usage: prebuild /target [options]"); - Console.WriteLine("Available command-line switches:"); - Console.WriteLine(); - Console.WriteLine("/target Target for Prebuild"); - Console.WriteLine("/clean Clean the build files for the given target"); - Console.WriteLine("/file XML file to process"); - Console.WriteLine("/log Log file to write to"); - Console.WriteLine("/ppo Pre-process the file, but perform no other processing"); - Console.WriteLine("/pause Pauses the application after execution to view the output"); - Console.WriteLine("/yes Default to yes to any questions asked"); - Console.WriteLine("/install Install assembly into the GAC"); - Console.WriteLine("/remove Remove assembly from the GAC"); - Console.WriteLine(); - Console.WriteLine("See 'prebuild /showtargets for a list of available targets"); - Console.WriteLine("See readme.txt or check out http://dnpb.sourceforge.net for more information"); - Console.WriteLine(); - } - - private static void OutputTargets(Kernel kern) - { - Console.WriteLine("Targets available in Prebuild:"); - Console.WriteLine(""); - if(kern.Targets.Keys.Count > 0) - { - string[] targs = new string[kern.Targets.Keys.Count]; - kern.Targets.Keys.CopyTo(targs, 0); - Array.Sort(targs); - foreach(string target in targs) - { - Console.WriteLine(target); - } - } - Console.WriteLine(""); - } - - #endregion - } -} diff --git a/Programs/Prebuild/src/Prebuild.snk b/Programs/Prebuild/src/Prebuild.snk deleted file mode 100644 index f9dce054..00000000 Binary files a/Programs/Prebuild/src/Prebuild.snk and /dev/null differ diff --git a/Programs/Prebuild/src/Properties/AssemblyInfo.cs b/Programs/Prebuild/src/Properties/AssemblyInfo.cs deleted file mode 100644 index 5f61a66c..00000000 --- a/Programs/Prebuild/src/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,121 +0,0 @@ -#region BSD License -/* - -Copyright (c) 2004 - 2008 -Matthew Holmes (matthew@wildfiregames.com), -Dan Moorehead (dan05a@gmail.com), -Dave Hudson (jendave@yahoo.com), -Rob Loach (http://www.robloach.net), -C.J. Adams-Collier (cjac@colliertech.org), - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -* Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -* The name of the author may not be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, -INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING -IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -*/ -#endregion - -#region CVS Information -/* - * $Source$ - * $Author: cjcollier $ - * $Date: 2008-02-07 08:31:29 -0800 (Thu, 07 Feb 2008) $ - * $Revision: 256 $ - */ -#endregion - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Security.Permissions; -using System.Resources; - - -// FxCop recommended attributes -[assembly: ComVisible(false)] -[assembly: FileIOPermission(SecurityAction.RequestMinimum, Unrestricted=true)] -[assembly: CLSCompliant(true)] - -// -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -// -[assembly: AssemblyTitle(".NET Prebuild")] -[assembly: AssemblyDescription("A .NET project file build tool")] -[assembly: AssemblyConfiguration(".NET CLR")] -[assembly: AssemblyCompany("The Prebuild Project")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("Copyright 2004-2008 " + - "Matthew Holmes, " + - "Dan Moorehead, " + - "C.J. Adams-Collier, " + - "Rob Loach, " + - "David Hudson,")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguageAttribute("en-US")] -[assembly: AssemblyVersion("2.0.3.*")] - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyName("")] diff --git a/Programs/Prebuild/src/data/autotools.xml b/Programs/Prebuild/src/data/autotools.xml deleted file mode 100644 index ee4b0643..00000000 --- a/Programs/Prebuild/src/data/autotools.xml +++ /dev/null @@ -1,790 +0,0 @@ - - - - - #!/bin/sh -# Run this to generate all the initial makefiles, etc. -# Ripped off from Mono, which ripped off from GNOME macros version - -DIE=0 - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -if [ -n "$MONO_PATH" ]; then - # from -> /mono/lib:/another/mono/lib - # to -> /mono /another/mono - for i in `echo ${MONO_PATH} | tr ":" " "`; do - i=`dirname ${i}` - if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then - ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS" - fi - if [ -n "{i}" -a -d "${i}/bin" ]; then - PATH="${i}/bin:$PATH" - fi - done - export PATH -fi - -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`autoconf' installed to compile Mono." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -} - -if [ -z "$LIBTOOL" ]; then - LIBTOOL=`which glibtool 2>/dev/null` - if [ ! -x "$LIBTOOL" ]; then - LIBTOOL=`which libtool` - fi -fi - -(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { - ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`libtool' installed to compile Mono." - echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && { - grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \ - (gettext --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`gettext' installed to compile Mono." - echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`automake' installed to compile Mono." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - NO_AUTOMAKE=yes -} - -# if no automake, don't bother testing for aclocal -test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: Missing \`aclocal'. The version of \`automake'" - echo "installed doesn't appear recent enough." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 -} - -if test "$DIE" -eq 1; then - exit 1 -fi - -if test -z "$NOCONFIGURE"; then - -if test -z "$*"; then - echo "**Warning**: I am going to run \`configure' with no arguments." - echo "If you wish to pass any to it, please specify them on the" - echo \`$0\'" command line." - echo -fi - -fi - -case $CC in -xlc ) - am_opt=--include-deps;; -esac - - -if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then - if test -z "$NO_LIBTOOLIZE" ; then - echo "Running libtoolize..." - ${LIBTOOL}ize --force --copy - fi -fi - -echo "Running aclocal $ACLOCAL_FLAGS ..." -aclocal $ACLOCAL_FLAGS || { - echo - echo "**Error**: aclocal failed. This may mean that you have not" - echo "installed all of the packages you need, or you may need to" - echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" - echo "for the prefix where you installed the packages whose" - echo "macros were not found" - exit 1 -} - -if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then - echo "Running autoheader..." - autoheader || { echo "**Error**: autoheader failed."; exit 1; } -fi - -echo "Running automake --gnu $am_opt ..." -automake --add-missing --gnu $am_opt || - { echo "**Error**: automake failed."; exit 1; } -echo "Running autoconf ..." -autoconf || { echo "**Error**: autoconf failed."; exit 1; } - -conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c - -if test x$NOCONFIGURE = x; then - echo Running $srcdir/configure $conf_flags "$@" ... - $srcdir/configure $conf_flags "$@" \ - && echo Now type \`make\' to compile $PKG_NAME || exit 1 -else - echo Skipping configure process. -fi - - - - - - - - - - - - - - - - AC_INIT([],[]) - -AC_PREREQ(2.60) -AC_CANONICAL_SYSTEM -AC_CONFIG_AUX_DIR(.) -AM_INIT_AUTOMAKE([1.9 tar-ustar foreign]) -AM_MAINTAINER_MODE -dnl AC_PROG_INTLTOOL([0.25]) -AC_PROG_INSTALL - -ASSEMBLY_NAME= -PROJECT_NAME= -PROJECT_VERSION=$VERSION -PROJECT_DESCRIPTION="" -PROJECT_TYPE="" - -AC_SUBST(ASSEMBLY_NAME) -AC_SUBST(PROJECT_NAME) -AC_SUBST(PROJECT_VERSION) -AC_SUBST(DESCRIPTION) - -AC_MSG_CHECKING([assembly type]) -case $PROJECT_TYPE in - *Exe) - ASSEMBLY_EXTENSION=exe - ;; - *Library) - ASSEMBLY_EXTENSION=dll - ;; - *) - AC_MSG_ERROR([*** Please add support for project type $PROJECT_TYPE to configure.ac checks!]) - ;; -esac -AC_MSG_RESULT([$PROJECT_TYPE]) - -AC_SUBST(ASSEMBLY_EXTENSION) - -AC_MSG_CHECKING([whether we're compiling from an RCS]) -if test -f "$srcdir/.cvs_version" ; then - from_rcs=cvs -else - if test -f "$srcdir/.svn/entries" ; then - from_rcs=svn - else - from_rcs=no - fi -fi - -AC_MSG_RESULT($from_rcs) - -MONO_REQUIRED_VERSION=1.1 - -PKG_CHECK_MODULES(MONO_DEPENDENCY, mono >= $MONO_REQUIRED_VERSION, has_mono=true, has_mono=false) - -if test "x$has_mono" = "xtrue"; then - AC_PATH_PROG(RUNTIME, mono, no) - AC_PATH_PROG(CSC, gmcs, no) - AC_PATH_PROG(RESGEN, resgen2, no) - if test `uname -s` = "Darwin"; then - LIB_PREFIX= - LIB_SUFFIX=.dylib - else - LIB_PREFIX=.so - LIB_SUFFIX= - fi -else - AC_PATH_PROG(CSC, csc.exe, no) - if test x$CSC = "xno"; then - AC_MSG_ERROR([You need to install either mono or .Net]) - else - RUNTIME= - LIB_PREFIX= - LIB_SUFFIX= - fi -fi - -AC_PATH_PROG(GACUTIL, gacutil) -if test "x$GACUTIL" = "xno" ; then - AC_MSG_ERROR([No gacutil tool found]) -fi - -GACUTIL_FLAGS='/package /gacdir $(DESTDIR)$(prefix)/lib' -AC_SUBST(GACUTIL_FLAGS) - -AC_SUBST(PATH) -AC_SUBST(LD_LIBRARY_PATH) - -AC_SUBST(LIB_PREFIX) -AC_SUBST(LIB_SUFFIX) -AC_SUBST(RUNTIME) -AC_SUBST(CSC) -AC_SUBST(RESGEN) -AC_SUBST(GACUTIL) - -AC_SUBST(BASE_DEPENDENCIES_CFLAGS) -AC_SUBST(BASE_DEPENDENCIES_LIBS) - -dnl Find monodoc -MONODOC_REQUIRED_VERSION=1.0 -AC_SUBST(MONODOC_REQUIRED_VERSION) - -PKG_CHECK_MODULES(MONODOC_DEPENDENCY, monodoc >= $MONODOC_REQUIRED_VERSION, enable_monodoc=yes, enable_monodoc=no) - -if test "x$enable_monodoc" = "xyes"; then - AC_PATH_PROG(MONODOC, monodoc, no) - if test x$MONODOC = xno; then - enable_monodoc=no - fi -else - MONODOC= -fi - -AC_SUBST(MONODOC) -AM_CONDITIONAL(ENABLE_MONODOC, test "x$enable_monodoc" = "xyes") - -winbuild=no -case "$host" in - *-*-mingw*|*-*-cygwin*) - winbuild=yes - ;; -esac -AM_CONDITIONAL(WINBUILD, test x$winbuild = xyes) - -AC_CONFIG_FILES() -AC_CONFIG_FILES(.pc) - -AC_CONFIG_FILES(Makefile) -AC_OUTPUT - -echo "===" -echo "" -echo "Project configuration summary" -echo "" -echo " * Installation prefix: $prefix" -echo " * compiler: $CSC" -echo " * Documentation: $enable_monodoc ($MONODOC)" -echo " * Project Name: $PROJECT_NAME" -echo " * Version: $PROJECT_VERSION" -echo "" -echo "===" - - - - - - - - - - - - - - - - - - - - - - - - - - -ASSEMBLY=$(ASSEMBLY_NAME).$(ASSEMBLY_EXTENSION) - - -dir = $(prefix)/lib/ -_DATA = $(ASSEMBLY) $(ASSEMBLY).config - -bin_SCRIPTS= - -pkgconfigdir = $(prefix)/lib/pkgconfig -pkgconfig_DATA = .pc - -dir = $(prefix)/lib/mono/ -_DATA = $(ASSEMBLY).config - -noinst_DATA = $(ASSEMBLY) - - -PACKAGES = -BINARY_LIBS = -SYSTEM_LIBS = -RESOURCES_SRC = -RESOURCES = $(RESOURCES_SRC:.resx=.resources) -SOURCES = - -EXTRA_DIST=$(SOURCES) $(BINARY_LIBS) $(RESOURCES_SRC) install-sh missing - -CLEANFILES=$(ASSEMBLY) - - - - - - - -/$(ASSEMBLY): $(srcdir)/$(ASSEMBLY).response $(RESOURCES) $(SOURCES) $(BINARY_LIBS) - mkdir -p doc && mkdir -p && $(CSC) /out:$@ \ - /target: \ - $(addprefix /resource:$(srcdir)/, $(RESOURCES)) \ - $(addprefix /pkg:, $(PACKAGES)) \ - $(addprefix /r:, $(SYSTEM_LIBS)) \ - $(addprefix /r:$(srcdir)/, $(BINARY_LIBS)) \ - @$(srcdir)/$(ASSEMBLY).response \ - /doc:doc/ \ - /keyfile:$(srcdir)/ \ - /unsafe \ - && rm -f $(ASSEMBLY) \ - && ln $@ $(ASSEMBLY) - -CLEANFILES+=/$(ASSEMBLY) - - -EXTRA_DIST+= - -: /$(ASSEMBLY) - rm -f $(ASSEMBLY) \ - && ln /$(ASSEMBLY) $(ASSEMBLY) - - - - - -_install-data-local: /$(ASSEMBLY) - echo "$(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS)"; \ - $(GACUTIL) /i $(ASSEMBLY) /f $(GACUTIL_FLAGS) || exit 1; - -_uninstall-local: - if [`gacutil -l | grep "Number" | awk -F= '{print $$2}'` -gt "0" ] ; \ - then \ - echo "$(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS)"; \ - $(GACUTIL) /u $(ASSEMBLY_NAME) $(GACUTIL_FLAGS) || exit 1; \ - fi - - - -noinst__dir = $(prefix)/lib/mono/ -noinst___DATA = /$(ASSEMBLY) - - - - - - -$(ASSEMBLY): - - -$(srcdir)/$(ASSEMBLY).response: $(srcdir)/Makefile - echo "$(addprefix $(srcdir)/, $(SOURCES))" > $@ - - -all: $(ASSEMBLY) - -# rule to compile .resx files to .resources -%.resources: %.resx - $(RESGEN) /useSourcePath /compile $(@:.resources=.resx) - - - - - -install-data-local: _install-data-local - -uninstall-local: _uninstall-local - - - -#dir+=$(noinst__dir) -#_DATA+=$(noinst___DATA) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -prefix=@prefix@ -exec_prefix=${prefix} -libdir=${exec_prefix}/lib/mono/@PROJECT_NAME@ - -Name: -Description: -Version: @PROJECT_VERSION@ -Requires: -Libs: -r:${libdir}/@PROJECT_NAME@.dll - - - - - - - - - - - #!/bin/sh -# Run this to generate all the initial makefiles, etc. -# Ripped off from Mono, which ripped off from GNOME macros version - -DIE=0 - -srcdir=`dirname $0` -test -z "$srcdir" && srcdir=. - -if [ -n "$MONO_PATH" ]; then - # from -> /mono/lib:/another/mono/lib - # to -> /mono /another/mono - for i in `echo ${MONO_PATH} | tr ":" " "`; do - i=`dirname ${i}` - if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then - ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS" - fi - if [ -n "{i}" -a -d "${i}/bin" ]; then - PATH="${i}/bin:$PATH" - fi - done - export PATH -fi - -(autoconf --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`autoconf' installed to compile Mono." - echo "Download the appropriate package for your distribution," - echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" - DIE=1 -} - -if [ -z "$LIBTOOL" ]; then - LIBTOOL=`which glibtool 2>/dev/null` - if [ ! -x "$LIBTOOL" ]; then - LIBTOOL=`which libtool` - fi -fi - -(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && { - ($LIBTOOL --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`libtool' installed to compile Mono." - echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && { - grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \ - (gettext --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`gettext' installed to compile Mono." - echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - } -} - -(automake --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: You must have \`automake' installed to compile Mono." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 - NO_AUTOMAKE=yes -} - - -# if no automake, don't bother testing for aclocal -test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { - echo - echo "**Error**: Missing \`aclocal'. The version of \`automake'" - echo "installed doesn't appear recent enough." - echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz" - echo "(or a newer version if it is available)" - DIE=1 -} - -if test "$DIE" -eq 1; then - exit 1 -fi - -if test -z "$*"; then - echo "**Warning**: I am going to run \`configure' with no arguments." - echo "If you wish to pass any to it, please specify them on the" - echo \`$0\'" command line." - echo -fi - -case $CC in -xlc ) - am_opt=--include-deps;; -esac - - -if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then - if test -z "$NO_LIBTOOLIZE" ; then - echo "Running libtoolize..." - ${LIBTOOL}ize --force --copy - fi -fi - -echo "Running aclocal $ACLOCAL_FLAGS ..." -aclocal $ACLOCAL_FLAGS || { - echo - echo "**Error**: aclocal failed. This may mean that you have not" - echo "installed all of the packages you need, or you may need to" - echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\"" - echo "for the prefix where you installed the packages whose" - echo "macros were not found" - exit 1 -} - -if grep "^AM_CONFIG_HEADER" configure.ac >/dev/null; then - echo "Running autoheader..." - autoheader || { echo "**Error**: autoheader failed."; exit 1; } -fi - -echo "Running automake --gnu $am_opt ..." -automake --add-missing --gnu $am_opt || - { echo "**Error**: automake failed."; exit 1; } -echo "Running autoconf ..." -autoconf || { echo "**Error**: autoconf failed."; exit 1; } - - -echo Running /autogen.sh ... -(cd $srcdir/ ; NOCONFIGURE=1 /bin/sh ./autogen.sh "$@") -echo Done running /autogen.sh ... - - -conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c - -if test x$NOCONFIGURE = x; then - echo Running $srcdir/configure $conf_flags "$@" ... - $srcdir/configure $conf_flags "$@" \ - && echo Now type \`make\' to compile $PKG_NAME || exit 1 -else - echo Skipping configure process. -fi - - - - - - - - - - -AC_INIT([]-solution,[]) -AC_CONFIG_AUX_DIR(.) -AM_INIT_AUTOMAKE([1.9 tar-ustar foreign]) -EXTRA_DIST="install-sh missing" -SOLUTION_NAME= -SOLUTION_VERSION=$VERSION -SOLUTION_DESCRIPTION="" -AC_SUBST(DESCRIPTION) - -AM_MAINTAINER_MODE - -dnl AC_PROG_INTLTOOL([0.25]) - -AC_PROG_INSTALL - -AC_MSG_CHECKING([whether we're building from an RCS]) -if test -f "$srcdir/.cvs_version" ; then - from_rcs=cvs -else - if test -f "$srcdir/.svn/entries" ; then - from_rcs=svn - else - from_rcs=no - fi -fi - -AC_MSG_RESULT($from_rcs) - -CONFIG="Release" -AC_SUBST(CONFIG) - -AC_CONFIG_SUBDIRS( -) - - -AC_OUTPUT([ -Makefile -]) - -echo "===" -echo "" -echo "Solution configuration summary" -echo "" -echo " * Solution Name: $SOLUTION_NAME" -echo " * Version: $SOLUTION_VERSION" -echo " * Packages:" -echo " - " -echo "" -echo "===" - - - - - - - - - SUBDIRS = - - - - - - - - - - - - -#! /bin/sh - -PACKAGE= -prefix=@prefix@ -exec_prefix=@exec_prefix@ - -# %%$@%$# why oh why isn't it $sharedir/ -# Day changed to 30 Mar 2007 -# ... -# 07:50 < cj> why are we installing .exe assemblies to $prefix/lib/$package/ and -# not $prefix/share/$package ? -# 07:50 < jonp> momentum. -# 07:50 < jonp> and it's hard to say that a .exe isn't platform specific -# 07:50 < jonp> as it can still contain DllImport's which make platform -# assumptions - -packagedir=$prefix/lib/ -export MONO_PATH=$MONO_PATH - -exec @RUNTIME@ $packagedir/$PACKAGE.exe "$@" - - - - - diff --git a/Programs/Prebuild/src/data/dnpb-1.0.xsd b/Programs/Prebuild/src/data/dnpb-1.0.xsd deleted file mode 100644 index 45cab863..00000000 --- a/Programs/Prebuild/src/data/dnpb-1.0.xsd +++ /dev/null @@ -1,183 +0,0 @@ - - - - - Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com) - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Programs/Prebuild/src/data/dnpb-1.1.xsd b/Programs/Prebuild/src/data/dnpb-1.1.xsd deleted file mode 100644 index c402cebc..00000000 --- a/Programs/Prebuild/src/data/dnpb-1.1.xsd +++ /dev/null @@ -1,184 +0,0 @@ - - - - - Copyright (c) 2004 Matthew Holmes (kerion@houston.rr.com) - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Programs/Prebuild/src/data/dnpb-1.2.xsd b/Programs/Prebuild/src/data/dnpb-1.2.xsd deleted file mode 100644 index 8004af74..00000000 --- a/Programs/Prebuild/src/data/dnpb-1.2.xsd +++ /dev/null @@ -1,198 +0,0 @@ - - - - - Copyright (c) 2004 Matthew Holmes (calefaction _at_ houston _._ rr _._ com) - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Programs/Prebuild/src/data/dnpb-1.3.xsd b/Programs/Prebuild/src/data/dnpb-1.3.xsd deleted file mode 100644 index 5f8ada1e..00000000 --- a/Programs/Prebuild/src/data/dnpb-1.3.xsd +++ /dev/null @@ -1,206 +0,0 @@ - - - - - Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) - - .NET Pre-Build is an XML-driven pre-build tool allowing developers to - easily generate project or make files for major IDE's and .NET - development tools including: Visual Studio 2003, Visual Studio 2002, - SharpDevelop, MonoDevelop, and NAnt. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Programs/Prebuild/src/data/dnpb-1.4.xsd b/Programs/Prebuild/src/data/dnpb-1.4.xsd deleted file mode 100644 index 54f9ac00..00000000 --- a/Programs/Prebuild/src/data/dnpb-1.4.xsd +++ /dev/null @@ -1,212 +0,0 @@ - - - - - Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002 and - 2003, SharpDevelop, MonoDevelop, and NAnt. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Programs/Prebuild/src/data/dnpb-1.5.xsd b/Programs/Prebuild/src/data/dnpb-1.5.xsd deleted file mode 100644 index 2270e836..00000000 --- a/Programs/Prebuild/src/data/dnpb-1.5.xsd +++ /dev/null @@ -1,215 +0,0 @@ - - - - - Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002 and - 2003, SharpDevelop, MonoDevelop, and NAnt. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Programs/Prebuild/src/data/prebuild-1.6.xsd b/Programs/Prebuild/src/data/prebuild-1.6.xsd deleted file mode 100644 index f944fafc..00000000 --- a/Programs/Prebuild/src/data/prebuild-1.6.xsd +++ /dev/null @@ -1,231 +0,0 @@ - - - - - Copyright (c) 2004-2005 Matthew Holmes (calefaction at houston . rr . com), Dan Moorehead (dan05a at gmail . com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002 and - 2003, SharpDevelop, MonoDevelop, and NAnt. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Programs/Prebuild/src/data/prebuild-1.7.xsd b/Programs/Prebuild/src/data/prebuild-1.7.xsd deleted file mode 100644 index e1d73d84..00000000 --- a/Programs/Prebuild/src/data/prebuild-1.7.xsd +++ /dev/null @@ -1,333 +0,0 @@ - - - - - Copyright (c) 2004-2007 - Matthew Holmes (calefaction at houston . rr . com), - Dan Moorehead (dan05a at gmail . com), - David Hudson (jendave at yahoo dot com), - C.J. Adams-Collier (cjac at colliertech dot com) - - .NET Prebuild is a cross-platform XML-driven pre-build tool which - allows developers to easily generate project or make files for major - IDE's and .NET development tools including: Visual Studio .NET 2002, - 2003, and 2005, SharpDevelop, MonoDevelop, NAnt, Xcode and the GNU Autotools. - - BSD License: - - Redistribution and use in source and binary forms, with or without modification, are permitted - provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions - and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, this list of conditions - and the following disclaimer in the documentation and/or other materials provided with the - distribution. - * The name of the author may not be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR 'AS IS' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, - BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING - IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Programs/PrimWorkshop/PrimWorkshop.csproj b/Programs/PrimWorkshop/PrimWorkshop.csproj deleted file mode 100644 index 924a666c..00000000 --- a/Programs/PrimWorkshop/PrimWorkshop.csproj +++ /dev/null @@ -1,182 +0,0 @@ - - - Local - 14.0.25123 - 2.0 - {AC949F03-0000-0000-0000-000000000000} - Debug - - - - - PrimWorkshop - JScript - Grid - IE50 - false - v4.0 - WinExe - - - PrimWorkshop - - - - - - - - - True - 285212672 - False - - - TRACE;DEBUG - - - True - 4096 - False - ..\..\bin\ - False - False - False - 4 - False - 1591,1574,0419 - AnyCPU - - - True - 285212672 - False - - - TRACE - - - False - 4096 - True - ..\..\bin\ - False - False - False - 4 - False - 1591,1574,0419 - AnyCPU - - - - False - ..\..\bin\GlacialList.dll - - - ..\..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - - - ..\..\packages\Lyncee.OpenTK.1.1.1173.43181\lib\OpenTK.dll - - - ..\..\packages\Lyncee.OpenTK.Compatibility.1.1.1173.43181\lib\OpenTK.Compatibility.dll - - - ..\..\packages\OpenTK.GLControl.1.1.2349.61993\lib\NET40\OpenTK.GLControl.dll - - - System - False - - - System.Data - False - - - System.Drawing - False - - - System.Windows.Forms - False - - - System.Xml - False - - - - - LibreMetaverse - {27C70F3A-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - LibreMetaverse.StructuredData - {89D7A3E5-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - LibreMetaverseTypes - {B37B02AD-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Form - - - Form - - - Code - - - Code - - - Code - - - Code - - - frmBrowser.cs - - - frmBrowser.cs - - - frmPrimWorkshop.cs - - - frmPrimWorkshop.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Programs/PrimWorkshop/Program.cs b/Programs/PrimWorkshop/Program.cs deleted file mode 100644 index f06a569a..00000000 --- a/Programs/PrimWorkshop/Program.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Windows.Forms; - -namespace PrimWorkshop -{ - static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new frmPrimWorkshop()); - } - } -} \ No newline at end of file diff --git a/Programs/PrimWorkshop/Properties/AssemblyInfo.cs b/Programs/PrimWorkshop/Properties/AssemblyInfo.cs deleted file mode 100644 index 6d23e9f2..00000000 --- a/Programs/PrimWorkshop/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("primpreview")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Metaverse Industries LLC")] -[assembly: AssemblyProduct("primpreview")] -[assembly: AssemblyCopyright("Copyright © Metaverse Industries LLC 2007")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("8b942505-1bf6-4efe-afef-afde490540d5")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Programs/PrimWorkshop/Properties/Resources.Designer.cs b/Programs/PrimWorkshop/Properties/Resources.Designer.cs deleted file mode 100644 index e1a6b5c3..00000000 --- a/Programs/PrimWorkshop/Properties/Resources.Designer.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace PrimWorkshop.Properties -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources - { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() - { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager - { - get - { - if ((resourceMan == null)) - { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("primpreview.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture - { - get - { - return resourceCulture; - } - set - { - resourceCulture = value; - } - } - } -} diff --git a/Programs/PrimWorkshop/Properties/Resources.resx b/Programs/PrimWorkshop/Properties/Resources.resx deleted file mode 100644 index ffecec85..00000000 --- a/Programs/PrimWorkshop/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Programs/PrimWorkshop/Properties/Settings.Designer.cs b/Programs/PrimWorkshop/Properties/Settings.Designer.cs deleted file mode 100644 index 531461cb..00000000 --- a/Programs/PrimWorkshop/Properties/Settings.Designer.cs +++ /dev/null @@ -1,30 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.42 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace PrimWorkshop.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } - } - } -} diff --git a/Programs/PrimWorkshop/app.config b/Programs/PrimWorkshop/app.config deleted file mode 100644 index d4f722e0..00000000 --- a/Programs/PrimWorkshop/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/Programs/PrimWorkshop/frmBrowser.Designer.cs b/Programs/PrimWorkshop/frmBrowser.Designer.cs deleted file mode 100644 index 0f4685b2..00000000 --- a/Programs/PrimWorkshop/frmBrowser.Designer.cs +++ /dev/null @@ -1,383 +0,0 @@ -namespace PrimWorkshop -{ - partial class frmBrowser - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - GlacialComponents.Controls.GLColumn glColumn1 = new GlacialComponents.Controls.GLColumn(); - GlacialComponents.Controls.GLColumn glColumn2 = new GlacialComponents.Controls.GLColumn(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.glControl = new OpenTK.GLControl(); - this.panel1 = new System.Windows.Forms.Panel(); - this.txtPass = new System.Windows.Forms.TextBox(); - this.txtLast = new System.Windows.Forms.TextBox(); - this.txtFirst = new System.Windows.Forms.TextBox(); - this.cmdLogin = new System.Windows.Forms.Button(); - this.lstDownloads = new GlacialComponents.Controls.GlacialList(); - this.progPrims = new System.Windows.Forms.ProgressBar(); - this.lblPrims = new System.Windows.Forms.Label(); - this.cboServer = new System.Windows.Forms.ComboBox(); - this.panel2 = new System.Windows.Forms.Panel(); - this.txtSim = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.txtX = new System.Windows.Forms.TextBox(); - this.txtY = new System.Windows.Forms.TextBox(); - this.txtZ = new System.Windows.Forms.TextBox(); - this.cmdTeleport = new System.Windows.Forms.Button(); - this.tableLayoutPanel1.SuspendLayout(); - this.panel1.SuspendLayout(); - this.panel2.SuspendLayout(); - this.SuspendLayout(); - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel1.ColumnCount = 3; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 130F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 175F)); - this.tableLayoutPanel1.Controls.Add(this.glControl, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.lstDownloads, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.progPrims, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.lblPrims, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.panel2, 2, 0); - this.tableLayoutPanel1.Location = new System.Drawing.Point(1, 1); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 4; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 45F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 120F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(799, 612); - this.tableLayoutPanel1.TabIndex = 0; - // - // glControl - // - this.glControl.BackColor = System.Drawing.Color.Black; - this.tableLayoutPanel1.SetColumnSpan(this.glControl, 2); - this.glControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.glControl.Location = new System.Drawing.Point(3, 3); - this.glControl.Name = "glControl"; - this.glControl.Size = new System.Drawing.Size(618, 411); - this.glControl.TabIndex = 7; - this.glControl.TabStop = false; - this.glControl.MouseMove += new System.Windows.Forms.MouseEventHandler(this.glControl_MouseMove); - this.glControl.MouseClick += new System.Windows.Forms.MouseEventHandler(this.glControl_MouseClick); - this.glControl.MouseDown += new System.Windows.Forms.MouseEventHandler(this.glControl_MouseDown); - this.glControl.Resize += new System.EventHandler(this.glControl_Resize); - this.glControl.MouseUp += new System.Windows.Forms.MouseEventHandler(this.glControl_MouseUp); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel1.SetColumnSpan(this.panel1, 2); - this.panel1.Controls.Add(this.cboServer); - this.panel1.Controls.Add(this.txtPass); - this.panel1.Controls.Add(this.txtLast); - this.panel1.Controls.Add(this.txtFirst); - this.panel1.Controls.Add(this.cmdLogin); - this.panel1.Location = new System.Drawing.Point(3, 450); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(618, 39); - this.panel1.TabIndex = 8; - // - // txtPass - // - this.txtPass.Location = new System.Drawing.Point(215, 11); - this.txtPass.Name = "txtPass"; - this.txtPass.Size = new System.Drawing.Size(100, 20); - this.txtPass.TabIndex = 2; - this.txtPass.UseSystemPasswordChar = true; - this.txtPass.Enter += new System.EventHandler(this.txtLogin_Enter); - // - // txtLast - // - this.txtLast.Location = new System.Drawing.Point(109, 11); - this.txtLast.Name = "txtLast"; - this.txtLast.Size = new System.Drawing.Size(100, 20); - this.txtLast.TabIndex = 1; - this.txtLast.Enter += new System.EventHandler(this.txtLogin_Enter); - // - // txtFirst - // - this.txtFirst.Location = new System.Drawing.Point(3, 11); - this.txtFirst.Name = "txtFirst"; - this.txtFirst.Size = new System.Drawing.Size(100, 20); - this.txtFirst.TabIndex = 0; - this.txtFirst.Enter += new System.EventHandler(this.txtLogin_Enter); - // - // cmdLogin - // - this.cmdLogin.Location = new System.Drawing.Point(321, 9); - this.cmdLogin.Name = "cmdLogin"; - this.cmdLogin.Size = new System.Drawing.Size(75, 23); - this.cmdLogin.TabIndex = 3; - this.cmdLogin.Text = "Login"; - this.cmdLogin.UseVisualStyleBackColor = true; - this.cmdLogin.Click += new System.EventHandler(this.cmdLogin_Click); - // - // lstDownloads - // - this.lstDownloads.AllowColumnResize = true; - this.lstDownloads.AllowMultiselect = false; - this.lstDownloads.AlternateBackground = System.Drawing.Color.DarkGreen; - this.lstDownloads.AlternatingColors = false; - this.lstDownloads.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.lstDownloads.AutoHeight = true; - this.lstDownloads.BackColor = System.Drawing.SystemColors.ControlLightLight; - this.lstDownloads.BackgroundStretchToFit = true; - glColumn1.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; - glColumn1.CheckBoxes = false; - glColumn1.ImageIndex = -1; - glColumn1.Name = "colTextureID"; - glColumn1.NumericSort = false; - glColumn1.Text = "Texture ID"; - glColumn1.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - glColumn1.Width = 220; - glColumn2.ActivatedEmbeddedType = GlacialComponents.Controls.GLActivatedEmbeddedTypes.None; - glColumn2.CheckBoxes = false; - glColumn2.ImageIndex = -1; - glColumn2.Name = "colProgress"; - glColumn2.NumericSort = false; - glColumn2.Text = "Download Progress"; - glColumn2.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft; - glColumn2.Width = 220; - this.lstDownloads.Columns.AddRange(new GlacialComponents.Controls.GLColumn[] { - glColumn1, - glColumn2}); - this.tableLayoutPanel1.SetColumnSpan(this.lstDownloads, 2); - this.lstDownloads.ControlStyle = GlacialComponents.Controls.GLControlStyles.Normal; - this.lstDownloads.FullRowSelect = true; - this.lstDownloads.GridColor = System.Drawing.Color.LightGray; - this.lstDownloads.GridLines = GlacialComponents.Controls.GLGridLines.gridBoth; - this.lstDownloads.GridLineStyle = GlacialComponents.Controls.GLGridLineStyles.gridSolid; - this.lstDownloads.GridTypes = GlacialComponents.Controls.GLGridTypes.gridOnExists; - this.lstDownloads.HeaderHeight = 22; - this.lstDownloads.HeaderVisible = true; - this.lstDownloads.HeaderWordWrap = false; - this.lstDownloads.HotColumnTracking = false; - this.lstDownloads.HotItemTracking = false; - this.lstDownloads.HotTrackingColor = System.Drawing.Color.LightGray; - this.lstDownloads.HoverEvents = false; - this.lstDownloads.HoverTime = 1; - this.lstDownloads.ImageList = null; - this.lstDownloads.ItemHeight = 17; - this.lstDownloads.ItemWordWrap = false; - this.lstDownloads.Location = new System.Drawing.Point(3, 495); - this.lstDownloads.Name = "lstDownloads"; - this.lstDownloads.Selectable = true; - this.lstDownloads.SelectedTextColor = System.Drawing.Color.White; - this.lstDownloads.SelectionColor = System.Drawing.Color.DarkBlue; - this.lstDownloads.ShowBorder = true; - this.lstDownloads.ShowFocusRect = false; - this.lstDownloads.Size = new System.Drawing.Size(618, 114); - this.lstDownloads.SortType = GlacialComponents.Controls.SortTypes.InsertionSort; - this.lstDownloads.SuperFlatHeaderColor = System.Drawing.Color.White; - this.lstDownloads.TabIndex = 9; - this.lstDownloads.Text = "Texture Downloads"; - // - // progPrims - // - this.progPrims.Dock = System.Windows.Forms.DockStyle.Fill; - this.progPrims.Location = new System.Drawing.Point(133, 420); - this.progPrims.Name = "progPrims"; - this.progPrims.Size = new System.Drawing.Size(488, 24); - this.progPrims.TabIndex = 10; - // - // lblPrims - // - this.lblPrims.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.lblPrims.AutoSize = true; - this.lblPrims.Location = new System.Drawing.Point(3, 425); - this.lblPrims.Name = "lblPrims"; - this.lblPrims.Size = new System.Drawing.Size(61, 13); - this.lblPrims.TabIndex = 11; - this.lblPrims.Text = "Prims: 0 / 0"; - // - // cboServer - // - this.cboServer.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.cboServer.FormattingEnabled = true; - this.cboServer.Location = new System.Drawing.Point(405, 11); - this.cboServer.Name = "cboServer"; - this.cboServer.Size = new System.Drawing.Size(204, 21); - this.cboServer.TabIndex = 4; - // - // panel2 - // - this.panel2.Controls.Add(this.cmdTeleport); - this.panel2.Controls.Add(this.txtZ); - this.panel2.Controls.Add(this.txtY); - this.panel2.Controls.Add(this.txtX); - this.panel2.Controls.Add(this.label5); - this.panel2.Controls.Add(this.label4); - this.panel2.Controls.Add(this.label3); - this.panel2.Controls.Add(this.label2); - this.panel2.Controls.Add(this.txtSim); - this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel2.Location = new System.Drawing.Point(627, 3); - this.panel2.Name = "panel2"; - this.tableLayoutPanel1.SetRowSpan(this.panel2, 4); - this.panel2.Size = new System.Drawing.Size(169, 606); - this.panel2.TabIndex = 12; - // - // txtSim - // - this.txtSim.Location = new System.Drawing.Point(36, 8); - this.txtSim.Name = "txtSim"; - this.txtSim.Size = new System.Drawing.Size(126, 20); - this.txtSim.TabIndex = 1; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(3, 11); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(27, 13); - this.label2.TabIndex = 2; - this.label2.Text = "Sim:"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(5, 37); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(17, 13); - this.label3.TabIndex = 3; - this.label3.Text = "X:"; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(58, 37); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(17, 13); - this.label4.TabIndex = 4; - this.label4.Text = "Y:"; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(112, 37); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(17, 13); - this.label5.TabIndex = 5; - this.label5.Text = "Z:"; - // - // txtX - // - this.txtX.Location = new System.Drawing.Point(24, 34); - this.txtX.MaxLength = 3; - this.txtX.Name = "txtX"; - this.txtX.Size = new System.Drawing.Size(30, 20); - this.txtX.TabIndex = 6; - this.txtX.Text = "128"; - // - // txtY - // - this.txtY.Location = new System.Drawing.Point(78, 34); - this.txtY.MaxLength = 3; - this.txtY.Name = "txtY"; - this.txtY.Size = new System.Drawing.Size(30, 20); - this.txtY.TabIndex = 7; - this.txtY.Text = "128"; - // - // txtZ - // - this.txtZ.Location = new System.Drawing.Point(132, 34); - this.txtZ.MaxLength = 3; - this.txtZ.Name = "txtZ"; - this.txtZ.Size = new System.Drawing.Size(30, 20); - this.txtZ.TabIndex = 8; - this.txtZ.Text = "0"; - // - // cmdTeleport - // - this.cmdTeleport.Enabled = false; - this.cmdTeleport.Location = new System.Drawing.Point(87, 60); - this.cmdTeleport.Name = "cmdTeleport"; - this.cmdTeleport.Size = new System.Drawing.Size(75, 23); - this.cmdTeleport.TabIndex = 9; - this.cmdTeleport.Text = "Teleport"; - this.cmdTeleport.UseVisualStyleBackColor = true; - this.cmdTeleport.Click += new System.EventHandler(this.cmdTeleport_Click); - // - // frmBrowser - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 612); - this.Controls.Add(this.tableLayoutPanel1); - this.Name = "frmBrowser"; - this.Text = "World Browser"; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmBrowser_FormClosing); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.panel2.ResumeLayout(false); - this.panel2.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private OpenTK.GLControl glControl; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.TextBox txtPass; - private System.Windows.Forms.TextBox txtLast; - private System.Windows.Forms.TextBox txtFirst; - private System.Windows.Forms.Button cmdLogin; - private GlacialComponents.Controls.GlacialList lstDownloads; - private System.Windows.Forms.ProgressBar progPrims; - private System.Windows.Forms.Label lblPrims; - private System.Windows.Forms.ComboBox cboServer; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.TextBox txtZ; - private System.Windows.Forms.TextBox txtY; - private System.Windows.Forms.TextBox txtX; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox txtSim; - private System.Windows.Forms.Button cmdTeleport; - - } -} \ No newline at end of file diff --git a/Programs/PrimWorkshop/frmBrowser.cs b/Programs/PrimWorkshop/frmBrowser.cs deleted file mode 100644 index e30e78f5..00000000 --- a/Programs/PrimWorkshop/frmBrowser.cs +++ /dev/null @@ -1,1969 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; -using System.IO; -using System.Runtime.InteropServices; -using ICSharpCode.SharpZipLib.Zip; -using OpenTK.Graphics.OpenGL; -using OpenMetaverse; -using OpenMetaverse.StructuredData; -using OpenMetaverse.Imaging; -using OpenMetaverse.Rendering; -using OpenMetaverse.Assets; - -namespace PrimWorkshop -{ - public partial class frmBrowser : Form - { - const float DEG_TO_RAD = 0.0174532925f; - const uint TERRAIN_START = (uint)Int32.MaxValue + 1; - - ContextMenu ExportPrimMenu; - ContextMenu ExportTerrainMenu; - - GridClient Client; - Camera Camera; - Dictionary RenderFoliageList = new Dictionary(); - Dictionary RenderPrimList = new Dictionary(); - Dictionary DownloadList = new Dictionary(); - EventHandler IdleEvent; - - System.Timers.Timer ProgressTimer; - int TotalPrims; - - // Textures - Dictionary Textures = new Dictionary(); - - // Terrain - float MaxHeight = 0.1f; - TerrainPatch[,] Heightmap; - HeightmapLookupValue[] LookupHeightTable; - - // Picking globals - bool Clicked = false; - int ClickX = 0; - int ClickY = 0; - uint LastHit = 0; - - //warning CS0414: The private field `PrimWorkshop.frmBrowser.PivotPosition' is assigned but its value is never used - OpenMetaverse.Vector3 PivotPosition = OpenMetaverse.Vector3.Zero; - private bool Pivoting; - Point LastPivot; - - // - const int SELECT_BUFSIZE = 512; - uint[] SelectBuffer = new uint[SELECT_BUFSIZE]; - - //warning CS0414: The private field `PrimWorkshop.frmBrowser.msg' is assigned but its value is never used - NativeMethods.Message msg; - private bool AppStillIdle - { - get { return !NativeMethods.PeekMessage(out msg, IntPtr.Zero, 0, 0, 0); } - } - - /// - /// Default constructor - /// - public frmBrowser() - { - InitializeComponent(); - - // Setup OpenGL - glControl.SwapBuffers(); - glControl.MouseWheel += new MouseEventHandler(glControl_MouseWheel); - - // Login server URLs - cboServer.Items.Add(Settings.AGNI_LOGIN_SERVER); - cboServer.Items.Add(Settings.ADITI_LOGIN_SERVER); - cboServer.Items.Add("http://osgrid.org:8002/"); - cboServer.SelectedIndex = 0; - - // Context menus - ExportPrimMenu = new ContextMenu(); - ExportPrimMenu.MenuItems.Add("Download", new EventHandler(DownloadMenu_Clicked)); - ExportPrimMenu.MenuItems.Add("Download All Objects", new EventHandler(DownloadAllMenu_Clicked)); - ExportTerrainMenu = new ContextMenu(); - ExportTerrainMenu.MenuItems.Add("Teleport", new EventHandler(TeleportMenu_Clicked)); - ExportTerrainMenu.MenuItems.Add("Export Terrain", new EventHandler(ExportTerrainMenu_Clicked)); - ExportTerrainMenu.MenuItems.Add("Import Object", new EventHandler(ImportObjectMenu_Clicked)); - ExportTerrainMenu.MenuItems.Add("Import Sim", new EventHandler(ImportSimMenu_Clicked)); - - // Setup a timer for updating the progress bar - ProgressTimer = new System.Timers.Timer(250); - ProgressTimer.Elapsed += - delegate(object sender, System.Timers.ElapsedEventArgs e) - { - UpdatePrimProgress(); - }; - ProgressTimer.Start(); - - IdleEvent = new EventHandler(Application_Idle); - Application.Idle += IdleEvent; - - // Show a flat sim before login so the screen isn't so boring - InitHeightmap(); - InitOpenGL(); - InitCamera(); - - glControl_Resize(null, null); - } - - private void InitLists() - { - TotalPrims = 0; - - lock (Textures) - { - foreach (TextureInfo tex in Textures.Values) - { - int id = tex.ID; - GL.DeleteTextures(1, ref id); - } - - Textures.Clear(); - } - - lock (RenderPrimList) RenderPrimList.Clear(); - lock (RenderFoliageList) RenderFoliageList.Clear(); - } - - private void InitializeObjects() - { - InitLists(); - - if (DownloadList != null) - lock (DownloadList) - DownloadList.Clear(); - - // Initialize the SL client - Client = new GridClient(); - Client.Settings.MULTIPLE_SIMS = false; - Client.Settings.ALWAYS_DECODE_OBJECTS = true; - Client.Settings.ALWAYS_REQUEST_OBJECTS = true; - Client.Settings.SEND_AGENT_UPDATES = true; - Client.Settings.USE_ASSET_CACHE = true; - //Client.Settings.ASSET_CACHE_DIR = Application.StartupPath + System.IO.Path.DirectorySeparatorChar + "cache"; - Client.Settings.ALWAYS_REQUEST_PARCEL_ACL = false; - Client.Settings.ALWAYS_REQUEST_PARCEL_DWELL = false; - // Crank up the throttle on texture downloads - Client.Throttle.Texture = 446000.0f; - - // FIXME: Write our own avatar tracker so we don't double store prims - Client.Settings.OBJECT_TRACKING = false; // We use our own object tracking system - Client.Settings.AVATAR_TRACKING = true; //but we want to use the libsl avatar system - - Client.Network.LoginProgress += Network_OnLogin; - Client.Network.Disconnected += Network_OnDisconnected; - Client.Network.SimChanged += Network_OnCurrentSimChanged; - Client.Network.EventQueueRunning += Network_OnEventQueueRunning; - Client.Objects.ObjectUpdate += Objects_OnNewPrim; - Client.Terrain.LandPatchReceived += new EventHandler(Terrain_LandPatchReceived); - Client.Parcels.SimParcelsDownloaded += new EventHandler(Parcels_SimParcelsDownloaded); - Client.Assets.ImageReceiveProgress += new EventHandler(Assets_ImageReceiveProgress); - // Initialize the camera object - InitCamera(); - - // Setup the libsl camera to match our Camera struct - UpdateCamera(); - glControl_Resize(null, null); - - /* - // Enable lighting - Gl.glEnable(Gl.GL_LIGHTING); - Gl.glEnable(Gl.GL_LIGHT0); - float[] lightPosition = { 128.0f, 64.0f, 96.0f, 0.0f }; - Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_POSITION, lightPosition); - - // Setup ambient property - float[] ambientLight = { 0.2f, 0.2f, 0.2f, 0.0f }; - Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_AMBIENT, ambientLight); - - // Setup specular property - float[] specularLight = { 0.5f, 0.5f, 0.5f, 0.0f }; - Gl.glLightfv(Gl.GL_LIGHT0, Gl.GL_SPECULAR, specularLight); - */ - } - - void Objects_NewPrim(object sender, PrimEventArgs e) - { - throw new NotImplementedException(); - } - - void Parcels_SimParcelsDownloaded(object sender, SimParcelsDownloadedEventArgs e) - { - TotalPrims = 0; - - e.Parcels.ForEach( - delegate(Parcel parcel) - { - TotalPrims += parcel.TotalPrims; - }); - - UpdatePrimProgress(); TotalPrims = 0; - - e.Parcels.ForEach( - delegate(Parcel parcel) - { - TotalPrims += parcel.TotalPrims; - }); - - UpdatePrimProgress(); - } - - - private void InitOpenGL() - { - GL.ShadeModel(ShadingModel.Smooth); - - GL.ClearDepth(1d); - GL.Enable(EnableCap.DepthTest); - GL.DepthMask(true); - GL.DepthFunc(DepthFunction.Lequal); - GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); - } - - private void InitHeightmap() - { - // Initialize the heightmap - Heightmap = new TerrainPatch[16, 16]; - for (int y = 0; y < 16; y++) - { - for (int x = 0; x < 16; x++) - { - Heightmap[y, x] = new TerrainPatch(); - Heightmap[y, x].Data = new float[16 * 16]; - } - } - - // Speed up terrain exports with a lookup table - LookupHeightTable = new HeightmapLookupValue[256 * 256]; - for (int i = 0; i < 256; i++) - { - for (int j = 0; j < 256; j++) - { - LookupHeightTable[i + (j * 256)] = new HeightmapLookupValue((ushort)(i + (j * 256)), ((float)i * ((float)j / 127.0f))); - } - } - Array.Sort(LookupHeightTable); - } - - private void InitCamera() - { - Camera = new Camera(); - Camera.Position = new Vector3(128f, -192f, 90f); - Camera.FocalPoint = new Vector3(128f, 128f, 0f); - Camera.Zoom = 1.0d; - Camera.Far = 512.0d; - } - - private void UpdatePrimProgress() - { - if (this.InvokeRequired) - { - BeginInvoke((MethodInvoker)delegate() { UpdatePrimProgress(); }); - } - else - { - try - { - if (RenderPrimList != null && RenderFoliageList != null) - { - int count = RenderPrimList.Count + RenderFoliageList.Count; - - lblPrims.Text = String.Format("Prims: {0} / {1}", count, TotalPrims); - progPrims.Maximum = (TotalPrims > count) ? TotalPrims : count; - progPrims.Value = count; - } - else - { - lblPrims.Text = String.Format("Prims: 0 / {0}", TotalPrims); - progPrims.Maximum = TotalPrims; - progPrims.Value = 0; - } - } - catch (Exception ex) - { - Console.WriteLine(ex); - } - } - } - - private void UpdateCamera() - { - if (Client != null) - { - Client.Self.Movement.Camera.LookAt(Camera.Position, Camera.FocalPoint); - Client.Self.Movement.Camera.Far = (float)Camera.Far; - } - - GL.PushMatrix(); - GL.MatrixMode(MatrixMode.Projection); - GL.LoadIdentity(); - - SetPerspective(); - - GL.MatrixMode(MatrixMode.Modelview); - GL.PopMatrix(); - } - - private bool ExportObject(RenderablePrim parent, string fileName, out int prims, out int textures, out string error) - { - // Build a list of primitives (parent+children) to export - List primList = new List(); - primList.Add(parent.Prim); - - lock (RenderPrimList) - { - foreach (RenderablePrim render in RenderPrimList.Values) - { - if (render.Prim.ParentID == parent.Prim.LocalID) - primList.Add(render.Prim); - } - } - - return ExportObjects(primList, fileName, out prims, out textures, out error); - } - - private bool ExportSim(string fileName, out int prims, out int textures, out string error) - { - // Add all of the prims in this sim to the export list - List primList = new List(); - - lock (RenderPrimList) - { - foreach (RenderablePrim render in RenderPrimList.Values) - { - primList.Add(render.Prim); - } - } - - return ExportObjects(primList, fileName, out prims, out textures, out error); - } - - private bool ExportObjects(List primList, string fileName, out int prims, out int textures, out string error) - { - List textureList = new List(); - prims = 0; - textures = 0; - - // Write the LLSD to the hard drive in XML format - string output = OSDParser.SerializeLLSDXmlString(Helpers.PrimListToOSD(primList)); - try - { - // Create a temporary directory - string tempPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName()); - Directory.CreateDirectory(tempPath); - - // Write the prim XML file - File.WriteAllText(System.IO.Path.Combine(tempPath, "prims.xml"), output); - prims = primList.Count; - - // Build a list of all the referenced textures in this prim list - foreach (Primitive prim in primList) - { - for (int i = 0; i < prim.Textures.FaceTextures.Length; i++) - { - Primitive.TextureEntryFace face = prim.Textures.FaceTextures[i]; - if (face != null && face.TextureID != UUID.Zero && face.TextureID != Primitive.TextureEntry.WHITE_TEXTURE) - { - if (!textureList.Contains(face.TextureID)) - textureList.Add(face.TextureID); - } - } - } - - // Copy all of relevant textures from the cache to the temp directory - foreach (UUID texture in textureList) - { - string tempFileName = Client.Assets.Cache.AssetFileName(texture); - - if (!String.IsNullOrEmpty(tempFileName)) - { - File.Copy(tempFileName, System.IO.Path.Combine(tempPath, texture.ToString() + ".jp2")); - ++textures; - } - else - { - Console.WriteLine("Missing texture file during download: " + texture.ToString()); - } - } - - // Zip up the directory - string[] filenames = Directory.GetFiles(tempPath); - using (ZipOutputStream s = new ZipOutputStream(File.Create(fileName))) - { - s.SetLevel(9); - byte[] buffer = new byte[4096]; - - foreach (string file in filenames) - { - ZipEntry entry = new ZipEntry(System.IO.Path.GetFileName(file)); - entry.DateTime = DateTime.Now; - s.PutNextEntry(entry); - - using (FileStream fs = File.OpenRead(file)) - { - int sourceBytes; - do - { - sourceBytes = fs.Read(buffer, 0, buffer.Length); - s.Write(buffer, 0, sourceBytes); - } while (sourceBytes > 0); - } - } - - s.Finish(); - s.Close(); - } - - error = null; - return true; - } - catch (Exception ex) - { - error = ex.Message; - return false; - } - } - - private List ImportObjects(string fileName, out string tempPath, out string error) - { - tempPath = null; - error = null; - string primFile = null; - - try - { - // Create a temporary directory - tempPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName()); - Directory.CreateDirectory(tempPath); - - // Unzip the primpackage - using (ZipInputStream s = new ZipInputStream(File.OpenRead(fileName))) - { - ZipEntry theEntry; - - // Loop through and confirm there is a prims.xml file - while ((theEntry = s.GetNextEntry()) != null) - { - if (String.Equals("prims.xml", theEntry.Name.ToLower())) - { - primFile = theEntry.Name; - break; - } - } - - if (primFile != null) - { - // Prepend the path to the primFile (that will be created in the next loop) - primFile = System.IO.Path.Combine(tempPath, primFile); - } - else - { - // Didn't find a prims.xml file, bail out - error = "No prims.xml file found in the archive"; - return null; - } - - // Reset to the beginning of the zip file - s.Seek(0, SeekOrigin.Begin); - - Logger.DebugLog("Unpacking archive to " + tempPath); - - // Unzip all of the texture and xml files - while ((theEntry = s.GetNextEntry()) != null) - { - string directory = System.IO.Path.GetDirectoryName(theEntry.Name); - string file = System.IO.Path.GetFileName(theEntry.Name); - - // Skip directories - if (directory.Length > 0) - continue; - - if (!String.IsNullOrEmpty(file)) - { - string filelow = file.ToLower(); - - if (filelow.EndsWith(".jp2") || filelow.EndsWith(".tga") || filelow.EndsWith(".xml")) - { - Logger.DebugLog("Unpacking " + file); - - // Create the full path from the temp path and new filename - string filePath = System.IO.Path.Combine(tempPath, file); - - using (FileStream streamWriter = File.Create(filePath)) - { - const int READ_BUFFER_SIZE = 2048; - int size = READ_BUFFER_SIZE; - byte[] data = new byte[READ_BUFFER_SIZE]; - - while (true) - { - size = s.Read(data, 0, data.Length); - if (size > 0) - streamWriter.Write(data, 0, size); - else - break; - } - } - } - else - { - Logger.Log("Skipping file " + file, Helpers.LogLevel.Info); - } - } - } - } - - // Decode the .prims file - string raw = File.ReadAllText(primFile); - OSD osd = OSDParser.DeserializeLLSDXml(raw); - return Helpers.OSDToPrimList(osd); - } - catch (Exception e) - { - error = e.Message; - return null; - } - } - - private void DownloadMenu_Clicked(object sender, EventArgs e) - { - // Confirm that there actually is a selected object - RenderablePrim parent; - if (RenderPrimList.TryGetValue(LastHit, out parent)) - { - if (parent.Prim.ParentID == 0) - { - // Valid parent prim is selected, throw up the save file dialog - SaveFileDialog dialog = new SaveFileDialog(); - dialog.Filter = "Prim Package (*.zip)|*.zip"; - - if (dialog.ShowDialog() == DialogResult.OK) - { - string error; - int prims, textures; - if (ExportObject(parent, dialog.FileName, out prims, out textures, out error)) - MessageBox.Show(String.Format("Exported {0} prims and {1} textures", prims, textures)); - else - MessageBox.Show("Export failed: " + error); - } - } - else - { - // This should have already been fixed in the picking processing code - Console.WriteLine("Download menu clicked when a child prim is selected!"); - glControl.ContextMenu = null; - LastHit = 0; - } - } - else - { - Console.WriteLine("Download menu clicked when there is no selected prim!"); - glControl.ContextMenu = null; - LastHit = 0; - } - } - - private void DownloadAllMenu_Clicked(object sender, EventArgs e) - { - SaveFileDialog dialog = new SaveFileDialog(); - dialog.Filter = "Prim Package (*.zip)|*.zip"; - - if (dialog.ShowDialog() == DialogResult.OK) - { - string error; - int prims, textures; - if (ExportSim(dialog.FileName, out prims, out textures, out error)) - MessageBox.Show(String.Format("Exported {0} prims and {1} textures", prims, textures)); - else - MessageBox.Show("Export failed: " + error); - } - } - - private void ExportTerrainMenu_Clicked(object sender, EventArgs e) - { - // Valid parent prim is selected, throw up the save file dialog - SaveFileDialog dialog = new SaveFileDialog(); - dialog.Filter = "Terrain RAW (*.raw)|*.raw"; - - if (dialog.ShowDialog() == DialogResult.OK) - { - BackgroundWorker worker = new BackgroundWorker(); - worker.DoWork += delegate(object obj, DoWorkEventArgs args) - { - byte red, green, blue, alpha1, alpha2, alpha3, alpha4, alpha5, alpha6, alpha7, alpha8, alpha9, alpha10; - - try - { - FileInfo file = new FileInfo(dialog.FileName); - FileStream s = file.Open(FileMode.OpenOrCreate, FileAccess.Write); - BinaryWriter binStream = new BinaryWriter(s); - - for (int y = 0; y < 256; y++) - { - for (int x = 0; x < 256; x++) - { - int xBlock = x / 16; - int yBlock = y / 16; - int xOff = x - (xBlock * 16); - int yOff = y - (yBlock * 16); - - float t = Heightmap[yBlock, xBlock].Data[yOff * 16 + xOff]; - //float min = Single.MaxValue; - int index = 0; - - // The lookup table is pre-sorted, so we either find an exact match or - // the next closest (smaller) match with a binary search - index = Array.BinarySearch(LookupHeightTable, new HeightmapLookupValue(0, t)); - if (index < 0) - index = ~index - 1; - - index = LookupHeightTable[index].Index; - - /*for (int i = 0; i < 65536; i++) - { - if (Math.Abs(t - LookupHeightTable[i].Value) < min) - { - min = Math.Abs(t - LookupHeightTable[i].Value); - index = i; - } - }*/ - - red = (byte)(index & 0xFF); - green = (byte)((index >> 8) & 0xFF); - blue = 20; - alpha1 = 0; // Land Parcels - alpha2 = 0; // For Sale Land - alpha3 = 0; // Public Edit Object - alpha4 = 0; // Public Edit Land - alpha5 = 255; // Safe Land - alpha6 = 255; // Flying Allowed - alpha7 = 255; // Create Landmark - alpha8 = 255; // Outside Scripts - alpha9 = red; - alpha10 = green; - - binStream.Write(red); - binStream.Write(green); - binStream.Write(blue); - binStream.Write(alpha1); - binStream.Write(alpha2); - binStream.Write(alpha3); - binStream.Write(alpha4); - binStream.Write(alpha5); - binStream.Write(alpha6); - binStream.Write(alpha7); - binStream.Write(alpha8); - binStream.Write(alpha9); - binStream.Write(alpha10); - } - } - - binStream.Close(); - s.Close(); - - BeginInvoke((MethodInvoker)delegate() { System.Windows.Forms.MessageBox.Show("Exported heightmap"); }); - } - catch (Exception ex) - { - BeginInvoke((MethodInvoker)delegate() { System.Windows.Forms.MessageBox.Show("Error exporting heightmap: " + ex.Message); }); - } - }; - - worker.RunWorkerAsync(); - } - } - - private void TeleportMenu_Clicked(object sender, EventArgs e) - { - if (Client != null && Client.Network.CurrentSim != null) - { - if (LastHit >= TERRAIN_START) - { - // Determine which piece of terrain was clicked on - int y = (int)(LastHit - TERRAIN_START) / 16; - int x = (int)(LastHit - (TERRAIN_START + (y * 16))); - - Vector3 targetPos = new Vector3(x * 16 + 8, y * 16 + 8, 0f); - - Console.WriteLine("Starting local teleport to " + targetPos.ToString()); - Client.Self.RequestTeleport(Client.Network.CurrentSim.Handle, targetPos); - } - else - { - // This shouldn't have happened... - glControl.ContextMenu = null; - } - } - } - - private void ImportObjectMenu_Clicked(object sender, EventArgs e) - { - OpenFileDialog dialog = new OpenFileDialog(); - dialog.Filter = "Prim Package (*.zip,*.primpackage)|*.zip;*.primpackage"; - - if (dialog.ShowDialog() == DialogResult.OK) - { - // FIXME: Disable any further imports or exports until this is finished - - // Import the prims - string error, texturePath; - List primList = ImportObjects(dialog.FileName, out texturePath, out error); - if (primList != null) - { - // Determine the total height of the object - float minHeight = Single.MaxValue; - float maxHeight = Single.MinValue; - - //float totalHeight = 0f; - - for (int i = 0; i < primList.Count; i++) - { - Primitive prim = primList[i]; - - // Find the largest scale dimension (quick cheat to avoid figuring in the rotation) - float scale = prim.Scale.X; - if (prim.Scale.Y > scale) scale = prim.Scale.Y; - if (prim.Scale.Z > scale) scale = prim.Scale.Z; - - float top = prim.Position.Z + (scale * 0.5f); - float bottom = top - scale; - - if (top > maxHeight) maxHeight = top; - if (bottom < minHeight) minHeight = bottom; - } - - //totalHeight = maxHeight - minHeight; - - // Create a progress bar for the import process - ProgressBar prog = new ProgressBar(); - prog.Minimum = 0; - prog.Maximum = primList.Count; - prog.Value = 0; - - // List item - GlacialComponents.Controls.GLItem item = new GlacialComponents.Controls.GLItem(); - item.SubItems[0].Text = "Import process"; - item.SubItems[1].Control = prog; - - lstDownloads.Items.Add(item); - lstDownloads.Invalidate(); - - // Start the import process in the background - BackgroundWorker worker = new BackgroundWorker(); - - worker.DoWork += delegate(object s, DoWorkEventArgs ea) - { - // Set the spot choosing state - - // Wait for a spot to be chosen - - // mouse2dto3d() - - // Add (0, 0, totalHeight * 0.5f) to the clicked position - - for (int i = 0; i < primList.Count; i++) - { - Primitive prim = primList[i]; - - for (int j = 0; j < prim.Textures.FaceTextures.Length; j++) - { - // Check if this texture exists - - // If not, wait while it uploads - } - - // Create this prim (using weird SL math to get the correct position) - - // Wait for the callback to fire for this prim being created - - // Add this prim's localID to a list - - // Set any additional properties. If this is the root prim, do not apply rotation - - // Update the progress bar - BeginInvoke((MethodInvoker)delegate() { prog.Value = i; }); - } - - // Link all of the prims together - - // Apply root prim rotation - }; - - worker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs ea) - { - BeginInvoke( - (MethodInvoker)delegate() - { - lstDownloads.Items.Remove(item); - lstDownloads.Invalidate(); - }); - }; - - worker.RunWorkerAsync(); - } - else - { - // FIXME: Re-enable imports and exports - - MessageBox.Show(error); - return; - } - } - } - - private void ImportSimMenu_Clicked(object sender, EventArgs e) - { - } - - private void SetPerspective() - { - OpenTK.Matrix4 perspective = OpenTK.Matrix4.CreatePerspectiveFieldOfView( - 50.0f * (float)Camera.Zoom, 1.0f, 0.1f, (float)Camera.Far); - } - - private void GluPickMatrix(double x, double y, double deltax, double deltay, int[] viewport) - { - if (deltax <= 0 || deltay <= 0) return; - - GL.Translate((viewport[2] - 2 * (x - viewport[0])) / deltax, - (viewport[3] - 2 * (y - viewport[1])) / deltay, - 0); - GL.Scale(viewport[2] / deltax, viewport[3] / deltay, 1.0); - } - - private void StartPicking(int cursorX, int cursorY) - { - int[] viewport = new int[4]; - - GL.SelectBuffer(SELECT_BUFSIZE, SelectBuffer); - GL.RenderMode(RenderingMode.Select); - - GL.MatrixMode(MatrixMode.Projection); - GL.PushMatrix(); - GL.LoadIdentity(); - - GL.GetInteger(GetPName.Viewport, viewport); - GluPickMatrix(cursorX, viewport[3] - cursorY, 5, 5, viewport); - - SetPerspective(); - - GL.MatrixMode(MatrixMode.Modelview); - GL.InitNames(); - } - - private void StopPicking() - { - int hits; - - // Resotre the original projection matrix - GL.MatrixMode(MatrixMode.Projection); - GL.PopMatrix(); - GL.MatrixMode(MatrixMode.Modelview); - GL.Flush(); - - // Return to normal rendering mode - hits = GL.RenderMode(RenderingMode.Render); - - // If there are hits process them - if (hits != 0) - { - ProcessHits(hits, SelectBuffer); - } - else - { - LastHit = 0; - glControl.ContextMenu = null; - } - } - - private void ProcessHits(int hits, uint[] selectBuffer) - { - uint names = 0; - uint numNames = 0; - uint minZ = 0xffffffff; - uint ptr = 0; - uint ptrNames = 0; - - for (uint i = 0; i < hits; i++) - { - names = selectBuffer[ptr]; - ++ptr; - if (selectBuffer[ptr] < minZ) - { - numNames = names; - minZ = selectBuffer[ptr]; - ptrNames = ptr + 2; - } - - ptr += names + 2; - } - - ptr = ptrNames; - - for (uint i = 0; i < numNames; i++, ptr++) - { - LastHit = selectBuffer[ptr]; - } - - if (LastHit >= TERRAIN_START) - { - // Terrain was clicked on, turn off the context menu - glControl.ContextMenu = ExportTerrainMenu; - } - else - { - RenderablePrim render; - if (RenderPrimList.TryGetValue(LastHit, out render)) - { - if (render.Prim.ParentID == 0) - { - Camera.FocalPoint = render.Prim.Position; - UpdateCamera(); - } - else - { - // See if we have the parent - RenderablePrim renderParent; - if (RenderPrimList.TryGetValue(render.Prim.ParentID, out renderParent)) - { - // Turn on the context menu - glControl.ContextMenu = ExportPrimMenu; - - // Change the clicked on prim to the parent. Camera position stays on the - // clicked child but the highlighting is applied to all the children - LastHit = renderParent.Prim.LocalID; - - Camera.FocalPoint = renderParent.Prim.Position + render.Prim.Position; - UpdateCamera(); - } - else - { - Console.WriteLine("Clicked on a child prim with no parent!"); - LastHit = 0; - } - } - } - } - } - - private void Objects_OnNewPrim(object sender, PrimEventArgs e) - { - Primitive prim = e.Prim; - if (prim.PrimData.PCode == PCode.Grass || prim.PrimData.PCode == PCode.Tree || prim.PrimData.PCode == PCode.NewTree) - { - lock (RenderFoliageList) - RenderFoliageList[prim.LocalID] = prim; - return; - } - - RenderablePrim render = new RenderablePrim(); - render.Prim = prim; - - // FIXME: Handle sculpted prims by calling Render.Plugin.GenerateFacetedSculptMesh() instead - render.Mesh = Render.Plugin.GenerateFacetedMesh(prim, DetailLevel.High); - - // Create a FaceData struct for each face that stores the 3D data - // in a Tao.OpenGL friendly format - for (int j = 0; j < render.Mesh.Faces.Count; j++) - { - Face face = render.Mesh.Faces[j]; - FaceData data = new FaceData(); - - // Vertices for this face - data.Vertices = new float[face.Vertices.Count * 3]; - for (int k = 0; k < face.Vertices.Count; k++) - { - data.Vertices[k * 3 + 0] = face.Vertices[k].Position.X; - data.Vertices[k * 3 + 1] = face.Vertices[k].Position.Y; - data.Vertices[k * 3 + 2] = face.Vertices[k].Position.Z; - } - - // Indices for this face - data.Indices = face.Indices.ToArray(); - - // Texture transform for this face - Primitive.TextureEntryFace teFace = prim.Textures.GetFace((uint)j); - Render.Plugin.TransformTexCoords(face.Vertices, face.Center, teFace, prim.Scale); - - // Texcoords for this face - data.TexCoords = new float[face.Vertices.Count * 2]; - for (int k = 0; k < face.Vertices.Count; k++) - { - data.TexCoords[k * 2 + 0] = face.Vertices[k].TexCoord.X; - data.TexCoords[k * 2 + 1] = face.Vertices[k].TexCoord.Y; - } - - // Texture for this face - if (teFace.TextureID != UUID.Zero && - teFace.TextureID != Primitive.TextureEntry.WHITE_TEXTURE) - { - lock (Textures) - { - if (!Textures.ContainsKey(teFace.TextureID)) - { - // We haven't constructed this image in OpenGL yet, get ahold of it - Client.Assets.RequestImage(teFace.TextureID, ImageType.Normal, TextureDownloader_OnDownloadFinished); - } - } - } - - // Set the UserData for this face to our FaceData struct - face.UserData = data; - render.Mesh.Faces[j] = face; - } - - lock (RenderPrimList) RenderPrimList[prim.LocalID] = render; - } - - private void Terrain_LandPatchReceived(object sender, LandPatchReceivedEventArgs e) - { - if (Client != null && Client.Network.CurrentSim == e.Simulator) - { - Heightmap[e.Y, e.X].Data = e.HeightMap; - } - - // Find the new max height - for (int i = 0; i < e.HeightMap.Length; i++) - { - if (e.HeightMap[i] > MaxHeight) - MaxHeight = e.HeightMap[i]; - } - } - - private void Network_OnLogin(object sender, LoginProgressEventArgs e) - { - if (e.Status == LoginStatus.Success) - { - // Success! - } - else if (e.Status == LoginStatus.Failed) - { - BeginInvoke( - (MethodInvoker)delegate() - { - MessageBox.Show(this, String.Format("Error logging in ({0}): {1}", - Client.Network.LoginErrorKey, Client.Network.LoginMessage)); - cmdLogin.Text = "Login"; - txtFirst.Enabled = txtLast.Enabled = txtPass.Enabled = true; - }); - } - } - - private void Network_OnDisconnected(object sender, DisconnectedEventArgs e) - { - BeginInvoke( - (MethodInvoker)delegate() - { - cmdTeleport.Enabled = false; - DoLogout(); - }); - } - - private void Network_OnCurrentSimChanged(object sender, SimChangedEventArgs e) - { - Console.WriteLine("CurrentSim set to " + Client.Network.CurrentSim + ", downloading parcel information"); - - BeginInvoke((MethodInvoker)delegate() { txtSim.Text = Client.Network.CurrentSim.Name; }); - - //InitHeightmap(); - InitLists(); - - // Disable teleports until the new event queue comes online - if (!Client.Network.CurrentSim.Caps.IsEventQueueRunning) - BeginInvoke((MethodInvoker)delegate() { cmdTeleport.Enabled = false; }); - } - - private void Network_OnEventQueueRunning(object sender, EventQueueRunningEventArgs e) - { - if (e.Simulator == Client.Network.CurrentSim) - BeginInvoke((MethodInvoker)delegate() { cmdTeleport.Enabled = true; }); - - // Now seems like a good time to start requesting parcel information - Client.Parcels.RequestAllSimParcels(Client.Network.CurrentSim, false, 100); - } - - private void RenderScene() - { - try - { - GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); - GL.LoadIdentity(); - GL.EnableClientState(ArrayCap.VertexArray); - GL.EnableClientState(ArrayCap.TextureCoordArray); - - if (Clicked) - StartPicking(ClickX, ClickY); - - // Setup wireframe or solid fill drawing mode - GL.PolygonMode(MaterialFace.Front, PolygonMode.Line); - - // Position the camera - OpenTK.Matrix4 lookAt = OpenTK.Matrix4.LookAt( - Camera.Position.X, Camera.Position.Y, Camera.Position.Z, - Camera.FocalPoint.X, Camera.FocalPoint.Y, Camera.FocalPoint.Z, - 0f, 0f, 1f); - GL.MatrixMode(MatrixMode.Modelview); - GL.LoadMatrix(ref lookAt); - - RenderSkybox(); - - // Push the world matrix - GL.PushMatrix(); - - RenderTerrain(); - RenderPrims(); - RenderAvatars(); - - GL.DisableClientState(ArrayCap.TextureCoordArray); - GL.DisableClientState(ArrayCap.VertexArray); - - if (Clicked) - { - Clicked = false; - StopPicking(); - } - - // Pop the world matrix - GL.PopMatrix(); - GL.Flush(); - - glControl.Invalidate(); - } - catch (Exception) - { - } - } - - static readonly Vector3[] SkyboxVerts = new Vector3[] - { - // Right side - new Vector3( 10.0f, 10.0f, -10.0f ), //Top left - new Vector3( 10.0f, 10.0f, 10.0f ), //Top right - new Vector3( 10.0f, -10.0f, 10.0f ), //Bottom right - new Vector3( 10.0f, -10.0f, -10.0f ), //Bottom left - // Left side - new Vector3( -10.0f, 10.0f, 10.0f ), //Top left - new Vector3( -10.0f, 10.0f, -10.0f ), //Top right - new Vector3( -10.0f, -10.0f, -10.0f ), //Bottom right - new Vector3( -10.0f, -10.0f, 10.0f ), //Bottom left - // Top side - new Vector3( -10.0f, 10.0f, 10.0f ), //Top left - new Vector3( 10.0f, 10.0f, 10.0f ), //Top right - new Vector3( 10.0f, 10.0f, -10.0f ), //Bottom right - new Vector3( -10.0f, 10.0f, -10.0f ), //Bottom left - // Bottom side - new Vector3( -10.0f, -10.0f, -10.0f ), //Top left - new Vector3( 10.0f, -10.0f, -10.0f ), //Top right - new Vector3( 10.0f, -10.0f, 10.0f ), //Bottom right - new Vector3( -10.0f, -10.0f, 10.0f ), //Bottom left - // Front side - new Vector3( -10.0f, 10.0f, -10.0f ), //Top left - new Vector3( 10.0f, 10.0f, -10.0f ), //Top right - new Vector3( 10.0f, -10.0f, -10.0f ), //Bottom right - new Vector3( -10.0f, -10.0f, -10.0f ), //Bottom left - // Back side - new Vector3( 10.0f, 10.0f, 10.0f ), //Top left - new Vector3( -10.0f, 10.0f, 10.0f ), //Top right - new Vector3( -10.0f, -10.0f, 10.0f ), //Bottom right - new Vector3( 10.0f, -10.0f, 10.0f ), //Bottom left - }; - - private void RenderSkybox() - { - //Gl.glTranslatef(0f, 0f, 0f); - } - - private void RenderTerrain() - { - if (Heightmap != null) - { - int i = 0; - - // No texture - GL.BindTexture(TextureTarget.Texture2D, 0); - - for (int hy = 0; hy < 16; hy++) - { - for (int hx = 0; hx < 16; hx++) - { - uint patchName = (uint)(TERRAIN_START + i); - GL.PushName(patchName); - ++i; - - // Check if this patch is currently selected - bool selected = (LastHit == patchName); - - for (int y = 0; y < 15; y++) - { - GL.Begin(BeginMode.TriangleStrip); - for (int x = 0; x < 15; x++) - { - // Vertex 0 - float height = Heightmap[hy, hx].Data[y * 16 + x]; - float color = height / MaxHeight; - float red = (selected) ? 1f : color; - - GL.Color3(red, color, color); - GL.TexCoord2(0f, 0f); - GL.Vertex3(hx * 16 + x, hy * 16 + y, height); - - // Vertex 1 - height = Heightmap[hy, hx].Data[y * 16 + (x + 1)]; - color = height / MaxHeight; - red = (selected) ? 1f : color; - - GL.Color3(red, color, color); - GL.TexCoord2(1f, 0f); - GL.Vertex3(hx * 16 + x + 1, hy * 16 + y, height); - - // Vertex 2 - height = Heightmap[hy, hx].Data[(y + 1) * 16 + x]; - color = height / MaxHeight; - red = (selected) ? 1f : color; - - GL.Color3(red, color, color); - GL.TexCoord2(0f, 1f); - GL.Vertex3(hx * 16 + x, hy * 16 + y + 1, height); - - // Vertex 3 - height = Heightmap[hy, hx].Data[(y + 1) * 16 + (x + 1)]; - color = height / MaxHeight; - red = (selected) ? 1f : color; - - GL.Color3(red, color, color); - GL.TexCoord2(1f, 1f); - GL.Vertex3(hx * 16 + x + 1, hy * 16 + y + 1, height); - } - - GL.End(); - } - GL.PopName(); - } - } - } - } - - //int[] CubeMapDefines = new int[] - //{ - // Gl.GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB, - // Gl.GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB, - // Gl.GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB, - // Gl.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB, - // Gl.GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB, - // Gl.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB - //}; - - private void RenderPrims() - { - if (RenderPrimList != null && RenderPrimList.Count > 0) - { - GL.Enable(EnableCap.Texture2D); - - lock (RenderPrimList) - { - bool firstPass = true; - GL.Disable(EnableCap.Blend); - GL.Enable(EnableCap.DepthTest); - - StartRender: - - foreach (RenderablePrim render in RenderPrimList.Values) - { - RenderablePrim parentRender = RenderablePrim.Empty; - Primitive prim = render.Prim; - - if (prim.ParentID != 0) - { - // Get the parent reference - if (!RenderPrimList.TryGetValue(prim.ParentID, out parentRender)) - { - // Can't render a child with no parent prim, skip it - continue; - } - } - - GL.PushName(prim.LocalID); - GL.PushMatrix(); - - if (prim.ParentID != 0) - { - // Child prim - Primitive parent = parentRender.Prim; - - // Apply parent translation and rotation - GL.MultMatrix(Math3D.CreateTranslationMatrix(parent.Position)); - GL.MultMatrix(Math3D.CreateRotationMatrix(parent.Rotation)); - } - - // Apply prim translation and rotation - GL.MultMatrix(Math3D.CreateTranslationMatrix(prim.Position)); - GL.MultMatrix(Math3D.CreateRotationMatrix(prim.Rotation)); - - // Scale the prim - GL.Scale(prim.Scale.X, prim.Scale.Y, prim.Scale.Z); - - // Draw the prim faces - for (int j = 0; j < render.Mesh.Faces.Count; j++) - { - Face face = render.Mesh.Faces[j]; - FaceData data = (FaceData)face.UserData; - OpenMetaverse.Color4 color = face.TextureFace.RGBA; - bool alpha = false; - int textureID = 0; - - if (color.A < 1.0f) - alpha = true; - - #region Texturing - - TextureInfo info; - if (Textures.TryGetValue(face.TextureFace.TextureID, out info)) - { - if (info.Alpha) - alpha = true; - - textureID = info.ID; - - // Enable texturing for this face - GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill); - } - else - { - if (face.TextureFace.TextureID == Primitive.TextureEntry.WHITE_TEXTURE || - face.TextureFace.TextureID == UUID.Zero) - { - GL.PolygonMode(MaterialFace.Front, PolygonMode.Fill); - } - else - { - GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); - } - } - - if (firstPass && !alpha || !firstPass && alpha) - { - // Color this prim differently based on whether it is selected or not - if (LastHit == prim.LocalID || (LastHit != 0 && LastHit == prim.ParentID)) - { - GL.Color4(1f, color.G * 0.3f, color.B * 0.3f, color.A); - } - else - { - GL.Color4(color.R, color.G, color.B, color.A); - } - - // Bind the texture - GL.BindTexture(TextureTarget.Texture2D, textureID); - - GL.TexCoordPointer(2, TexCoordPointerType.Float, 0, data.TexCoords); - GL.VertexPointer(3, VertexPointerType.Float, 0, data.Vertices); - GL.DrawElements(BeginMode.Triangles, data.Indices.Length, DrawElementsType.UnsignedShort, data.Indices); - } - - #endregion Texturing - } - - GL.PopMatrix(); - GL.PopName(); - } - - if (firstPass) - { - firstPass = false; - GL.Enable(EnableCap.Blend); - GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); - - goto StartRender; - } - } - - GL.Enable(EnableCap.DepthTest); - GL.Disable(EnableCap.Texture2D); - } - } - - private void RenderAvatars() - { - if (Client != null && Client.Network.CurrentSim != null) - { - GL.Color3(0f, 1f, 0f); - - Client.Network.CurrentSim.ObjectsAvatars.ForEach( - delegate(Avatar avatar) - { - GL.PushMatrix(); - GL.Translate(avatar.Position.X, avatar.Position.Y, avatar.Position.Z); - - var quad = OpenTK.Graphics.Glu.NewQuadric(); - OpenTK.Graphics.Glu.Sphere(quad, 1.0d, 10, 10); - OpenTK.Graphics.Glu.DeleteQuadric(quad); - - GL.PopMatrix(); - } - ); - - GL.Color3(1f, 1f, 1f); - } - } - - #region Texture Downloading - - private void TextureDownloader_OnDownloadFinished(TextureRequestState state, AssetTexture asset) - { - bool alpha = false; - ManagedImage imgData = null; - byte[] raw = null; - - bool success = (state == TextureRequestState.Finished); - - UUID id = asset.AssetID; - - try - { - // Load the image off the disk - if (success) - { - //ImageDownload download = TextureDownloader.GetTextureToRender(id); - if (OpenJPEG.DecodeToImage(asset.AssetData, out imgData)) - { - raw = imgData.ExportRaw(); - - if ((imgData.Channels & ManagedImage.ImageChannels.Alpha) != 0) - alpha = true; - } - else - { - success = false; - Console.WriteLine("Failed to decode texture"); - } - } - - // Make sure the OpenGL commands run on the main thread - BeginInvoke( - (MethodInvoker)delegate() - { - if (success) - { - int textureID = 0; - - try - { - GL.GenTextures(1, out textureID); - GL.BindTexture(TextureTarget.Texture2D, textureID); - - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.LinearMipmapNearest); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)All.Repeat); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)All.Repeat); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.GenerateMipmap, 1); - - - //Gl.glTexImage2D(Gl.GL_TEXTURE_2D, 0, Gl.GL_RGBA, bitmap.Width, bitmap.Height, 0, Gl.GL_BGRA, Gl.GL_UNSIGNED_BYTE, - // bitmapData.Scan0); - //int error = Gl.glGetError(); - - int error = OpenTK.Graphics.Glu.Build2DMipmap(OpenTK.Graphics.TextureTarget.Texture2D, - (int)OpenTK.Graphics.PixelInternalFormat.Rgba, imgData.Width, imgData.Height, - OpenTK.Graphics.PixelFormat.Bgra, OpenTK.Graphics.PixelType.UnsignedByte, raw); - - if (error == 0) - { - Textures[id] = new TextureInfo(textureID, alpha); - Console.WriteLine("Created OpenGL texture for " + id.ToString()); - } - else - { - Textures[id] = new TextureInfo(0, false); - Console.WriteLine("Error creating OpenGL texture: " + error); - } - } - catch (Exception ex) - { - Console.WriteLine(ex); - } - } - - // Remove this image from the download listbox - lock (DownloadList) - { - GlacialComponents.Controls.GLItem item; - if (DownloadList.TryGetValue(id, out item)) - { - DownloadList.Remove(id); - try { lstDownloads.Items.Remove(item); } - catch (Exception) { } - lstDownloads.Invalidate(); - } - } - }); - } - catch (Exception ex) - { - Console.WriteLine(ex); - } - } - - private void Assets_ImageReceiveProgress(object sender, ImageReceiveProgressEventArgs e) - { - lock (DownloadList) - { - GlacialComponents.Controls.GLItem item; - if (DownloadList.TryGetValue(e.ImageID, out item)) - { - // Update an existing item - BeginInvoke( - (MethodInvoker)delegate() - { - ProgressBar prog = (ProgressBar)item.SubItems[1].Control; - if (e.Total >= e.Received) - prog.Value = (int)Math.Round((((double)e.Received / (double)e.Total) * 100.0d)); - }); - } - else - { - // Progress bar - ProgressBar prog = new ProgressBar(); - prog.Minimum = 0; - prog.Maximum = 100; - if (e.Total >= e.Received) - prog.Value = (int)Math.Round((((double)e.Received / (double)e.Total) * 100.0d)); - else - prog.Value = 0; - - // List item - item = new GlacialComponents.Controls.GLItem(); - item.SubItems[0].Text = e.ImageID.ToString(); - item.SubItems[1].Control = prog; - - DownloadList[e.ImageID] = item; - - BeginInvoke( - (MethodInvoker)delegate() - { - lstDownloads.Items.Add(item); - lstDownloads.Invalidate(); - }); - } - } - } - - #endregion Texture Downloading - - private void frmBrowser_FormClosing(object sender, FormClosingEventArgs e) - { - DoLogout(); - - Application.Idle -= IdleEvent; - } - - private void Application_Idle(object sender, EventArgs e) - { - while (AppStillIdle) - { - RenderScene(); - } - } - - private void cmdLogin_Click(object sender, EventArgs e) - { - if (cmdLogin.Text == "Login") - { - // Check that all the input boxes are filled in - if (txtFirst.Text.Length == 0) - { - txtFirst.Select(); - return; - } - if (txtLast.Text.Length == 0) - { - txtLast.Select(); - return; - } - if (txtPass.Text.Length == 0) - { - txtPass.Select(); - return; - } - - // Disable input controls - txtFirst.Enabled = txtLast.Enabled = txtPass.Enabled = false; - cmdLogin.Text = "Logout"; - - // Sanity check that we aren't already logged in - if (Client != null && Client.Network.Connected) - { - Client.Network.Logout(); - } - - // Re-initialize everything - InitializeObjects(); - - // Start the login - LoginParams loginParams = Client.Network.DefaultLoginParams(txtFirst.Text, txtLast.Text, - txtPass.Text, "Prim Preview", "0.0.1"); - - if (!String.IsNullOrEmpty(cboServer.Text)) - loginParams.URI = cboServer.Text; - - Client.Network.BeginLogin(loginParams); - } - else - { - DoLogout(); - } - } - - private void DoLogout() - { - if (Client != null && Client.Network.Connected) - { - Client.Network.Logout(); - return; - } - - // Clear the download list - lstDownloads.Items.Clear(); - - // Set the login button back to login state - cmdLogin.Text = "Login"; - - // Enable input controls - txtFirst.Enabled = txtLast.Enabled = txtPass.Enabled = true; - } - - private void glControl_Resize(object sender, EventArgs e) - { - GL.ClearColor(0.39f, 0.58f, 0.93f, 1.0f); - - GL.Viewport(0, 0, glControl.Width, glControl.Height); - - GL.PushMatrix(); - GL.MatrixMode(MatrixMode.Projection); - GL.LoadIdentity(); - - SetPerspective(); - - GL.MatrixMode(MatrixMode.Modelview); - GL.PopMatrix(); - - // Set the center of the glControl as the default pivot point - LastPivot = glControl.PointToScreen(new Point(glControl.Width / 2, glControl.Height / 2)); - } - - private void glControl_MouseClick(object sender, MouseEventArgs e) - { - if ((Control.ModifierKeys & Keys.Alt) == 0 && e.Button == MouseButtons.Left) - { - // Only allow clicking if alt is not being held down - ClickX = e.X; - ClickY = e.Y; - Clicked = true; - } - } - - private void glControl_MouseDown(object sender, MouseEventArgs e) - { - if ((Control.ModifierKeys & Keys.Alt) != 0 && LastHit > 0) - { - // Alt is held down and we have a valid target - Pivoting = true; - PivotPosition = Camera.FocalPoint; - - Control control = (Control)sender; - LastPivot = control.PointToScreen(new Point(e.X, e.Y)); - } - } - - private void glControl_MouseMove(object sender, MouseEventArgs e) - { - if (Pivoting) - { - float a, x, y, z; - - Control control = (Control)sender; - Point mouse = control.PointToScreen(new Point(e.X, e.Y)); - - // Calculate the deltas from the center of the control to the current position - int deltaX = (int)((mouse.X - LastPivot.X) * -0.5d); - int deltaY = (int)((mouse.Y - LastPivot.Y) * -0.5d); - - // Translate so the focal point is the origin - Vector3 altered = Camera.Position - Camera.FocalPoint; - - // Rotate the translated point by deltaX - a = (float)deltaX * DEG_TO_RAD; - x = (float)((altered.X * Math.Cos(a)) - (altered.Y * Math.Sin(a))); - y = (float)((altered.X * Math.Sin(a)) + (altered.Y * Math.Cos(a))); - - altered.X = x; - altered.Y = y; - - // Rotate the translated point by deltaY - a = (float)deltaY * DEG_TO_RAD; - y = (float)((altered.Y * Math.Cos(a)) - (altered.Z * Math.Sin(a))); - z = (float)((altered.Y * Math.Sin(a)) + (altered.Z * Math.Cos(a))); - - altered.Y = y; - altered.Z = z; - - // Translate back to world space - altered += Camera.FocalPoint; - - // Update the camera - Camera.Position = altered; - UpdateCamera(); - - // Update the pivot point - LastPivot = mouse; - } - } - - private void glControl_MouseWheel(object sender, MouseEventArgs e) - { - /*if (e.Delta != 0) - { - Camera.Zoom = Camera.Zoom + (double)(e.Delta / 120) * -0.1d; - if (Camera.Zoom < 0.05d) Camera.Zoom = 0.05d; - UpdateCamera(); - }*/ - - if (e.Delta != 0) - { - // Calculate the distance to move to/away - float dist = (float)(e.Delta / 120) * 10.0f; - - if (Vector3.Distance(Camera.Position, Camera.FocalPoint) > dist) - { - // Move closer or further away from the focal point - Vector3 toFocal = Camera.FocalPoint - Camera.Position; - toFocal.Normalize(); - - toFocal = toFocal * dist; - - Camera.Position += toFocal; - UpdateCamera(); - } - } - } - - private void glControl_MouseUp(object sender, MouseEventArgs e) - { - // Stop pivoting if we were previously - Pivoting = false; - } - - private void txtLogin_Enter(object sender, EventArgs e) - { - TextBox input = (TextBox)sender; - input.SelectAll(); - } - - private void cmdTeleport_Click(object sender, EventArgs e) - { - if (!String.IsNullOrEmpty(txtSim.Text)) - { - // Parse X/Y/Z - int x, y, z; - if (!Int32.TryParse(txtX.Text, out x)) - { - txtX.SelectAll(); - return; - } - if (!Int32.TryParse(txtY.Text, out y)) - { - txtY.SelectAll(); - return; - } - if (!Int32.TryParse(txtZ.Text, out z)) - { - txtZ.SelectAll(); - return; - } - - string simName = txtSim.Text.Trim().ToLower(); - Vector3 position = new Vector3(x, y, z); - - if (Client != null && Client.Network.CurrentSim != null) - { - // Check for a local teleport to shortcut the process - if (simName == Client.Network.CurrentSim.Name.ToLower()) - { - // Local teleport - Client.Self.RequestTeleport(Client.Network.CurrentSim.Handle, position); - } - else - { - // Cross-sim teleport - bool success = false; - - BackgroundWorker worker = new BackgroundWorker(); - worker.DoWork += delegate(object s, DoWorkEventArgs ea) { success = Client.Self.Teleport(simName, position); }; - worker.RunWorkerCompleted += delegate(object s, RunWorkerCompletedEventArgs ea) - { - BeginInvoke((MethodInvoker) - delegate() - { - if (!success) - System.Windows.Forms.MessageBox.Show("Teleport failed"); - }); - }; - - worker.RunWorkerAsync(); - } - } - else - { - // Oops! How did the user click this... - cmdTeleport.Enabled = false; - } - } - } - } - - public struct TextureInfo - { - /// OpenGL Texture ID - public int ID; - /// True if this texture has an alpha component - public bool Alpha; - - public TextureInfo(int id, bool alpha) - { - ID = id; - Alpha = alpha; - } - } - - public struct HeightmapLookupValue : IComparable - { - public ushort Index; - public float Value; - - public HeightmapLookupValue(ushort index, float value) - { - Index = index; - Value = value; - } - - public int CompareTo(HeightmapLookupValue val) - { - return Value.CompareTo(val.Value); - } - } - - public struct RenderablePrim - { - public Primitive Prim; - public FacetedMesh Mesh; - - public readonly static RenderablePrim Empty = new RenderablePrim(); - } - - public struct Camera - { - public Vector3 Position; - public Vector3 FocalPoint; - public double Zoom; - public double Far; - } - - public struct NativeMethods - { - [StructLayout(LayoutKind.Sequential)] - public struct Message - { - public IntPtr HWnd; - public uint Msg; - public IntPtr WParam; - public IntPtr LParam; - public uint Time; - public System.Drawing.Point Point; - } - - //[System.Security.SuppressUnmanagedCodeSecurity] - [DllImport("User32.dll", CharSet = CharSet.Auto)] - public static extern bool PeekMessage(out Message msg, IntPtr hWnd, uint messageFilterMin, uint messageFilterMax, uint flags); - } - - public static class Math3D - { - // Column-major: - // | 0 4 8 12 | - // | 1 5 9 13 | - // | 2 6 10 14 | - // | 3 7 11 15 | - - public static float[] CreateTranslationMatrix(Vector3 v) - { - float[] mat = new float[16]; - - mat[12] = v.X; - mat[13] = v.Y; - mat[14] = v.Z; - mat[0] = mat[5] = mat[10] = mat[15] = 1; - - return mat; - } - - public static float[] CreateRotationMatrix(Quaternion q) - { - float[] mat = new float[16]; - - // Transpose the quaternion (don't ask me why) - q.X = q.X * -1f; - q.Y = q.Y * -1f; - q.Z = q.Z * -1f; - - float x2 = q.X + q.X; - float y2 = q.Y + q.Y; - float z2 = q.Z + q.Z; - float xx = q.X * x2; - float xy = q.X * y2; - float xz = q.X * z2; - float yy = q.Y * y2; - float yz = q.Y * z2; - float zz = q.Z * z2; - float wx = q.W * x2; - float wy = q.W * y2; - float wz = q.W * z2; - - mat[0] = 1.0f - (yy + zz); - mat[1] = xy - wz; - mat[2] = xz + wy; - mat[3] = 0.0f; - - mat[4] = xy + wz; - mat[5] = 1.0f - (xx + zz); - mat[6] = yz - wx; - mat[7] = 0.0f; - - mat[8] = xz - wy; - mat[9] = yz + wx; - mat[10] = 1.0f - (xx + yy); - mat[11] = 0.0f; - - mat[12] = 0.0f; - mat[13] = 0.0f; - mat[14] = 0.0f; - mat[15] = 1.0f; - - return mat; - } - - public static float[] CreateScaleMatrix(Vector3 v) - { - float[] mat = new float[16]; - - mat[0] = v.X; - mat[5] = v.Y; - mat[10] = v.Z; - mat[15] = 1; - - return mat; - } - } -} diff --git a/Programs/PrimWorkshop/frmBrowser.resx b/Programs/PrimWorkshop/frmBrowser.resx deleted file mode 100644 index ff31a6db..00000000 --- a/Programs/PrimWorkshop/frmBrowser.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Programs/PrimWorkshop/frmPrimWorkshop.Designer.cs b/Programs/PrimWorkshop/frmPrimWorkshop.Designer.cs deleted file mode 100644 index 6b54675f..00000000 --- a/Programs/PrimWorkshop/frmPrimWorkshop.Designer.cs +++ /dev/null @@ -1,458 +0,0 @@ -namespace PrimWorkshop -{ - partial class frmPrimWorkshop - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - glControl.Context.Dispose(); - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.menu = new System.Windows.Forms.MenuStrip(); - this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.opToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.openPrimXMLToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.textureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator(); - this.savePrimXMLToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.saveTextureToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.importToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.worldBrowserToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.oBJToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator(); - this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.viewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.wireframeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.splitContainer = new System.Windows.Forms.SplitContainer(); - this.glControl = new OpenTK.GLControl(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.panel2 = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); - this.cboFace = new System.Windows.Forms.ComboBox(); - this.panel1 = new System.Windows.Forms.Panel(); - this.label1 = new System.Windows.Forms.Label(); - this.cboPrim = new System.Windows.Forms.ComboBox(); - this.scrollRoll = new System.Windows.Forms.HScrollBar(); - this.scrollPitch = new System.Windows.Forms.HScrollBar(); - this.scrollYaw = new System.Windows.Forms.HScrollBar(); - this.picTexture = new System.Windows.Forms.PictureBox(); - this.scrollZoom = new System.Windows.Forms.HScrollBar(); - this.menu.SuspendLayout(); - this.splitContainer.Panel1.SuspendLayout(); - this.splitContainer.Panel2.SuspendLayout(); - this.splitContainer.SuspendLayout(); - this.tableLayoutPanel1.SuspendLayout(); - this.panel2.SuspendLayout(); - this.panel1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picTexture)).BeginInit(); - this.SuspendLayout(); - // - // menu - // - this.menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.fileToolStripMenuItem, - this.viewToolStripMenuItem, - this.helpToolStripMenuItem}); - this.menu.Location = new System.Drawing.Point(0, 0); - this.menu.Name = "menu"; - this.menu.Size = new System.Drawing.Size(996, 24); - this.menu.TabIndex = 0; - this.menu.Text = "menu"; - // - // fileToolStripMenuItem - // - this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.opToolStripMenuItem, - this.toolStripMenuItem2, - this.savePrimXMLToolStripMenuItem, - this.saveTextureToolStripMenuItem, - this.importToolStripMenuItem, - this.exportToolStripMenuItem, - this.toolStripMenuItem1, - this.exitToolStripMenuItem}); - this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; - this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); - this.fileToolStripMenuItem.Text = "File"; - // - // opToolStripMenuItem - // - this.opToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.openPrimXMLToolStripMenuItem1, - this.textureToolStripMenuItem}); - this.opToolStripMenuItem.Name = "opToolStripMenuItem"; - this.opToolStripMenuItem.Size = new System.Drawing.Size(153, 22); - this.opToolStripMenuItem.Text = "Open"; - // - // openPrimXMLToolStripMenuItem1 - // - this.openPrimXMLToolStripMenuItem1.Name = "openPrimXMLToolStripMenuItem1"; - this.openPrimXMLToolStripMenuItem1.Size = new System.Drawing.Size(197, 22); - this.openPrimXMLToolStripMenuItem1.Text = "Prim XML / Sculpt Map"; - this.openPrimXMLToolStripMenuItem1.Click += new System.EventHandler(this.openPrimXMLToolStripMenuItem1_Click); - // - // textureToolStripMenuItem - // - this.textureToolStripMenuItem.Name = "textureToolStripMenuItem"; - this.textureToolStripMenuItem.Size = new System.Drawing.Size(197, 22); - this.textureToolStripMenuItem.Text = "Texture"; - this.textureToolStripMenuItem.Click += new System.EventHandler(this.textureToolStripMenuItem_Click); - // - // toolStripMenuItem2 - // - this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(150, 6); - // - // savePrimXMLToolStripMenuItem - // - this.savePrimXMLToolStripMenuItem.Name = "savePrimXMLToolStripMenuItem"; - this.savePrimXMLToolStripMenuItem.Size = new System.Drawing.Size(153, 22); - this.savePrimXMLToolStripMenuItem.Text = "Save Prim XML"; - this.savePrimXMLToolStripMenuItem.Click += new System.EventHandler(this.savePrimXMLToolStripMenuItem_Click); - // - // saveTextureToolStripMenuItem - // - this.saveTextureToolStripMenuItem.Name = "saveTextureToolStripMenuItem"; - this.saveTextureToolStripMenuItem.Size = new System.Drawing.Size(153, 22); - this.saveTextureToolStripMenuItem.Text = "Save Texture"; - this.saveTextureToolStripMenuItem.Click += new System.EventHandler(this.saveTextureToolStripMenuItem_Click); - // - // importToolStripMenuItem - // - this.importToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.worldBrowserToolStripMenuItem}); - this.importToolStripMenuItem.Name = "importToolStripMenuItem"; - this.importToolStripMenuItem.Size = new System.Drawing.Size(153, 22); - this.importToolStripMenuItem.Text = "Import"; - // - // worldBrowserToolStripMenuItem - // - this.worldBrowserToolStripMenuItem.Name = "worldBrowserToolStripMenuItem"; - this.worldBrowserToolStripMenuItem.Size = new System.Drawing.Size(151, 22); - this.worldBrowserToolStripMenuItem.Text = "World Browser"; - this.worldBrowserToolStripMenuItem.Click += new System.EventHandler(this.worldBrowserToolStripMenuItem_Click); - // - // exportToolStripMenuItem - // - this.exportToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.oBJToolStripMenuItem}); - this.exportToolStripMenuItem.Name = "exportToolStripMenuItem"; - this.exportToolStripMenuItem.Size = new System.Drawing.Size(153, 22); - this.exportToolStripMenuItem.Text = "Export"; - // - // oBJToolStripMenuItem - // - this.oBJToolStripMenuItem.Name = "oBJToolStripMenuItem"; - this.oBJToolStripMenuItem.Size = new System.Drawing.Size(135, 22); - this.oBJToolStripMenuItem.Text = "OBJ Format"; - this.oBJToolStripMenuItem.Click += new System.EventHandler(this.oBJToolStripMenuItem_Click); - // - // toolStripMenuItem1 - // - this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(150, 6); - // - // exitToolStripMenuItem - // - this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(153, 22); - this.exitToolStripMenuItem.Text = "Exit"; - this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); - // - // viewToolStripMenuItem - // - this.viewToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.wireframeToolStripMenuItem}); - this.viewToolStripMenuItem.Name = "viewToolStripMenuItem"; - this.viewToolStripMenuItem.Size = new System.Drawing.Size(44, 20); - this.viewToolStripMenuItem.Text = "View"; - // - // wireframeToolStripMenuItem - // - this.wireframeToolStripMenuItem.Checked = true; - this.wireframeToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; - this.wireframeToolStripMenuItem.Name = "wireframeToolStripMenuItem"; - this.wireframeToolStripMenuItem.Size = new System.Drawing.Size(129, 22); - this.wireframeToolStripMenuItem.Text = "Wireframe"; - this.wireframeToolStripMenuItem.Click += new System.EventHandler(this.wireframeToolStripMenuItem_Click); - // - // helpToolStripMenuItem - // - this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.aboutToolStripMenuItem}); - this.helpToolStripMenuItem.Name = "helpToolStripMenuItem"; - this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20); - this.helpToolStripMenuItem.Text = "Help"; - // - // aboutToolStripMenuItem - // - this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; - this.aboutToolStripMenuItem.Size = new System.Drawing.Size(107, 22); - this.aboutToolStripMenuItem.Text = "About"; - this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); - // - // splitContainer - // - this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer.Location = new System.Drawing.Point(0, 24); - this.splitContainer.Name = "splitContainer"; - // - // splitContainer.Panel1 - // - this.splitContainer.Panel1.Controls.Add(this.glControl); - // - // splitContainer.Panel2 - // - this.splitContainer.Panel2.Controls.Add(this.tableLayoutPanel1); - this.splitContainer.Size = new System.Drawing.Size(996, 512); - this.splitContainer.SplitterDistance = 550; - this.splitContainer.TabIndex = 6; - // - // glControl - // - this.glControl.BackColor = System.Drawing.Color.Black; - this.glControl.Dock = System.Windows.Forms.DockStyle.Fill; - this.glControl.Location = new System.Drawing.Point(0, 0); - this.glControl.Name = "glControl"; - this.glControl.Size = new System.Drawing.Size(550, 512); - this.glControl.TabIndex = 5; - this.glControl.Paint += new System.Windows.Forms.PaintEventHandler(this.glControl_Paint); - this.glControl.Resize += new System.EventHandler(this.glControl_Resize); - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel1.ColumnCount = 1; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.Controls.Add(this.panel2, 0, 5); - this.tableLayoutPanel1.Controls.Add(this.panel1, 0, 4); - this.tableLayoutPanel1.Controls.Add(this.scrollRoll, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.scrollPitch, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.scrollYaw, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.picTexture, 0, 6); - this.tableLayoutPanel1.Controls.Add(this.scrollZoom, 0, 3); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 7; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 24F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(442, 512); - this.tableLayoutPanel1.TabIndex = 9; - // - // panel2 - // - this.panel2.Controls.Add(this.label2); - this.panel2.Controls.Add(this.cboFace); - this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel2.Location = new System.Drawing.Point(3, 117); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(436, 24); - this.panel2.TabIndex = 16; - // - // label2 - // - this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(4, 5); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(34, 13); - this.label2.TabIndex = 16; - this.label2.Text = "Face:"; - this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // cboFace - // - this.cboFace.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cboFace.FormattingEnabled = true; - this.cboFace.Location = new System.Drawing.Point(40, 2); - this.cboFace.Name = "cboFace"; - this.cboFace.Size = new System.Drawing.Size(174, 21); - this.cboFace.TabIndex = 15; - this.cboFace.SelectedIndexChanged += new System.EventHandler(this.cboFace_SelectedIndexChanged); - // - // panel1 - // - this.panel1.Controls.Add(this.label1); - this.panel1.Controls.Add(this.cboPrim); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(3, 87); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(436, 24); - this.panel1.TabIndex = 15; - // - // label1 - // - this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left))); - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(4, 5); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(30, 13); - this.label1.TabIndex = 16; - this.label1.Text = "Prim:"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // cboPrim - // - this.cboPrim.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cboPrim.FormattingEnabled = true; - this.cboPrim.Location = new System.Drawing.Point(40, 2); - this.cboPrim.Name = "cboPrim"; - this.cboPrim.Size = new System.Drawing.Size(174, 21); - this.cboPrim.TabIndex = 15; - this.cboPrim.SelectedIndexChanged += new System.EventHandler(this.cboPrim_SelectedIndexChanged); - // - // scrollRoll - // - this.scrollRoll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.scrollRoll.Location = new System.Drawing.Point(0, 2); - this.scrollRoll.Maximum = 360; - this.scrollRoll.Name = "scrollRoll"; - this.scrollRoll.Size = new System.Drawing.Size(442, 16); - this.scrollRoll.TabIndex = 9; - this.scrollRoll.ValueChanged += new System.EventHandler(this.scroll_ValueChanged); - // - // scrollPitch - // - this.scrollPitch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.scrollPitch.Location = new System.Drawing.Point(0, 22); - this.scrollPitch.Maximum = 360; - this.scrollPitch.Name = "scrollPitch"; - this.scrollPitch.Size = new System.Drawing.Size(442, 16); - this.scrollPitch.TabIndex = 10; - this.scrollPitch.ValueChanged += new System.EventHandler(this.scroll_ValueChanged); - // - // scrollYaw - // - this.scrollYaw.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.scrollYaw.Location = new System.Drawing.Point(0, 42); - this.scrollYaw.Maximum = 360; - this.scrollYaw.Name = "scrollYaw"; - this.scrollYaw.Size = new System.Drawing.Size(442, 16); - this.scrollYaw.TabIndex = 11; - this.scrollYaw.ValueChanged += new System.EventHandler(this.scroll_ValueChanged); - // - // picTexture - // - this.picTexture.BackColor = System.Drawing.Color.Black; - this.picTexture.Dock = System.Windows.Forms.DockStyle.Fill; - this.picTexture.Location = new System.Drawing.Point(3, 147); - this.picTexture.Name = "picTexture"; - this.picTexture.Size = new System.Drawing.Size(436, 362); - this.picTexture.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.picTexture.TabIndex = 17; - this.picTexture.TabStop = false; - this.picTexture.Paint += new System.Windows.Forms.PaintEventHandler(this.picTexture_Paint); - this.picTexture.MouseDown += new System.Windows.Forms.MouseEventHandler(this.picTexture_MouseDown); - this.picTexture.MouseLeave += new System.EventHandler(this.picTexture_MouseLeave); - this.picTexture.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picTexture_MouseMove); - this.picTexture.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picTexture_MouseUp); - // - // scrollZoom - // - this.scrollZoom.Dock = System.Windows.Forms.DockStyle.Fill; - this.scrollZoom.LargeChange = 1; - this.scrollZoom.Location = new System.Drawing.Point(0, 60); - this.scrollZoom.Maximum = 0; - this.scrollZoom.Minimum = -800; - this.scrollZoom.Name = "scrollZoom"; - this.scrollZoom.Size = new System.Drawing.Size(442, 24); - this.scrollZoom.TabIndex = 19; - this.scrollZoom.Value = -50; - this.scrollZoom.ValueChanged += new System.EventHandler(this.scrollZoom_ValueChanged); - // - // frmPrimWorkshop - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(996, 536); - this.Controls.Add(this.splitContainer); - this.Controls.Add(this.menu); - this.MainMenuStrip = this.menu; - this.Name = "frmPrimWorkshop"; - this.Text = "Prim Workshop"; - this.Shown += new System.EventHandler(this.frmPrimWorkshop_Shown); - this.menu.ResumeLayout(false); - this.menu.PerformLayout(); - this.splitContainer.Panel1.ResumeLayout(false); - this.splitContainer.Panel2.ResumeLayout(false); - this.splitContainer.ResumeLayout(false); - this.tableLayoutPanel1.ResumeLayout(false); - this.panel2.ResumeLayout(false); - this.panel2.PerformLayout(); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.picTexture)).EndInit(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.MenuStrip menu; - private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripMenuItem1; - private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; - private System.Windows.Forms.SplitContainer splitContainer; - private OpenTK.GLControl glControl; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.HScrollBar scrollRoll; - private System.Windows.Forms.HScrollBar scrollPitch; - private System.Windows.Forms.HScrollBar scrollYaw; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ComboBox cboFace; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox cboPrim; - private System.Windows.Forms.PictureBox picTexture; - private System.Windows.Forms.ToolStripMenuItem savePrimXMLToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripMenuItem2; - private System.Windows.Forms.ToolStripMenuItem saveTextureToolStripMenuItem; - private System.Windows.Forms.HScrollBar scrollZoom; - private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem oBJToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem viewToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem wireframeToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem importToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem worldBrowserToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem opToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem openPrimXMLToolStripMenuItem1; - private System.Windows.Forms.ToolStripMenuItem textureToolStripMenuItem; - } -} - diff --git a/Programs/PrimWorkshop/frmPrimWorkshop.cs b/Programs/PrimWorkshop/frmPrimWorkshop.cs deleted file mode 100644 index c52e279a..00000000 --- a/Programs/PrimWorkshop/frmPrimWorkshop.cs +++ /dev/null @@ -1,703 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; -using System.Windows.Forms; -using ICSharpCode.SharpZipLib.Zip; -using OpenTK.Graphics.OpenGL; -using OpenMetaverse; -using OpenMetaverse.StructuredData; -using OpenMetaverse.Imaging; -using OpenMetaverse.Rendering; - -// NOTE: Batches are divided by texture, fullbright, shiny, transparent, and glow - -namespace PrimWorkshop -{ - public partial class frmPrimWorkshop : Form - { - #region Form Globals - - List Prims = null; - FacetedMesh CurrentPrim = null; - ProfileFace? CurrentFace = null; - - bool DraggingTexture = false; - bool Wireframe = true; - int[] TexturePointers = new int[1]; - Dictionary Textures = new Dictionary(); - - #endregion Form Globals - - public frmPrimWorkshop() - { - InitializeComponent(); - - GL.ShadeModel(ShadingModel.Smooth); - GL.ClearColor(Color.Black); - - GL.ClearDepth(1f); - GL.Enable(EnableCap.DepthTest); - GL.DepthMask(true); - GL.DepthFunc(DepthFunction.Lequal); - GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); - - TexturePointers[0] = 0; - - // Call the resizing function which sets up the GL drawing window - // and will also invalidate the GL control - glControl_Resize(null, null); - } - - private void frmPrimWorkshop_Shown(object sender, EventArgs e) - { - // Get a list of rendering plugins - List renderers = RenderingLoader.ListRenderers("."); - - foreach (string r in renderers) - { - DialogResult result = MessageBox.Show( - String.Format("Use renderer {0}?", r), "Select Rendering Plugin", MessageBoxButtons.YesNo); - - if (result == DialogResult.Yes) - { - Render.Plugin = RenderingLoader.LoadRenderer(r); - break; - } - } - - if (Render.Plugin == null) - { - MessageBox.Show("No valid rendering plugin loaded, exiting..."); - Application.Exit(); - } - } - - #region GLControl Callbacks - - private void glControl_Paint(object sender, PaintEventArgs e) - { - GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); - GL.LoadIdentity(); - - // Setup wireframe or solid fill drawing mode - if (Wireframe) - GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line); - else - GL.PolygonMode(MaterialFace.Front, PolygonMode.Fill); - - Vector3 center = Vector3.Zero; - - OpenTK.Matrix4 lookAt = OpenTK.Matrix4.LookAt( - center.X, scrollZoom.Value * 0.1f + center.Y, center.Z, - center.X, center.Y, center.Z, - 0f, 0f, 1f); - GL.LoadMatrix(ref lookAt); - - // Push the world matrix - GL.PushMatrix(); - - GL.EnableClientState(ArrayCap.VertexArray); - GL.EnableClientState(ArrayCap.TextureCoordArray); - - // World rotations - GL.Rotate((float)scrollRoll.Value, 1f, 0f, 0f); - GL.Rotate((float)scrollPitch.Value, 0f, 1f, 0f); - GL.Rotate((float)scrollYaw.Value, 0f, 0f, 1f); - - if (Prims != null) - { - for (int i = 0; i < Prims.Count; i++) - { - Primitive prim = Prims[i].Prim; - - if (i == cboPrim.SelectedIndex) - GL.Color3(1f, 0f, 0f); - else - GL.Color3(1f, 1f, 1f); - - // Individual prim matrix - GL.PushMatrix(); - - // The root prim position is sim-relative, while child prim positions are - // parent-relative. We want to apply parent-relative translations but not - // sim-relative ones - if (Prims[i].Prim.ParentID != 0) - { - // Apply prim translation and rotation - GL.MultMatrix(Math3D.CreateTranslationMatrix(prim.Position)); - GL.MultMatrix(Math3D.CreateRotationMatrix(prim.Rotation)); - } - - // Prim scaling - GL.Scale(prim.Scale.X, prim.Scale.Y, prim.Scale.Z); - - // Draw the prim faces - for (int j = 0; j < Prims[i].Faces.Count; j++) - { - if (i == cboPrim.SelectedIndex) - { - // This prim is currently selected in the dropdown - //Gl.glColor3f(0f, 1f, 0f); - GL.Color3(1f, 1f, 1f); - - if (j == cboFace.SelectedIndex) - { - // This face is currently selected in the dropdown - } - else - { - // This face is not currently selected in the dropdown - } - } - else - { - // This prim is not currently selected in the dropdown - GL.Color3(1f, 1f, 1f); - } - - #region Texturing - - Face face = Prims[i].Faces[j]; - FaceData data = (FaceData)face.UserData; - - if (data.TexturePointer != 0) - { - // Set the color to solid white so the texture is not altered - //Gl.glColor3f(1f, 1f, 1f); - // Enable texturing for this face - GL.Enable(EnableCap.Texture2D); - } - else - { - GL.Disable(EnableCap.Texture2D); - } - - // Bind the texture - GL.BindTexture(TextureTarget.Texture2D, data.TexturePointer); - - #endregion Texturing - - GL.TexCoordPointer(2, TexCoordPointerType.Float, 0, data.TexCoords); - GL.VertexPointer(3, VertexPointerType.Float, 0, data.Vertices); - GL.DrawElements(BeginMode.Triangles, data.Indices.Length, DrawElementsType.UnsignedShort, data.Indices); - } - - // Pop the prim matrix - GL.PopMatrix(); - } - } - - // Pop the world matrix - GL.PopMatrix(); - - GL.DisableClientState(ArrayCap.TextureCoordArray); - GL.DisableClientState(ArrayCap.VertexArray); - - GL.Flush(); - } - - private void glControl_Resize(object sender, EventArgs e) - { - GL.ClearColor(0.39f, 0.58f, 0.93f, 1.0f); - - GL.Viewport(0, 0, glControl.Width, glControl.Height); - - GL.PushMatrix(); - GL.MatrixMode(MatrixMode.Projection); - GL.LoadIdentity(); - - OpenTK.Matrix4 perspectiveMatrix = OpenTK.Matrix4.CreatePerspectiveFieldOfView(50.0f, 1.0f, 0.1f, 256f); - GL.LoadMatrix(ref perspectiveMatrix); - - GL.MatrixMode(MatrixMode.Modelview); - GL.PopMatrix(); - } - - #endregion GLControl Callbacks - - #region Menu Callbacks - - private void openPrimXMLToolStripMenuItem1_Click(object sender, EventArgs e) - { - Prims = null; - OpenFileDialog dialog = new OpenFileDialog(); - dialog.Filter = "Prim Package (*.zip)|*.zip|Sculpt Map (*.png)|*.png|OAR XML (*.xml)|*.xml"; - - if (dialog.ShowDialog() == DialogResult.OK) - { - if (dialog.FileName.ToLowerInvariant().EndsWith(".zip")) - { - LoadPrimPackage(dialog.FileName); - } - else if (dialog.FileName.ToLowerInvariant().EndsWith(".xml")) - { - LoadXmlPrim(dialog.FileName); - } - else - { - LoadSculpt(dialog.FileName); - } - } - } - - private void LoadDebugPrim() - { - Prims = new List(); - Primitive prim = new Primitive(); - prim.Textures = new Primitive.TextureEntry(UUID.Zero); - prim.Scale = Vector3.One; - prim.PrimData = ObjectManager.BuildBasicShape(PrimType.Cylinder); - prim.PrimData.ProfileHollow = 0.95f; - SimpleMesh simpleMesh = Render.Plugin.GenerateSimpleMesh(prim, DetailLevel.High); - FacetedMesh facetedMesh = new FacetedMesh(); - facetedMesh.Faces = new List { new Face { Vertices = simpleMesh.Vertices, Indices = simpleMesh.Indices } }; - facetedMesh.Path = simpleMesh.Path; - facetedMesh.Profile = simpleMesh.Profile; - facetedMesh.Prim = prim; - LoadMesh(facetedMesh, "."); - PopulatePrimCombobox(); - glControl.Invalidate(); - } - - private void LoadXmlPrim(string filename) - { - byte[] data = File.ReadAllBytes(filename); - - OpenMetaverse.Assets.OarFile.LoadObjects(data, XmlObjectLoadedHandler, 0, data.Length); - } - - private void XmlObjectLoadedHandler(OpenMetaverse.Assets.AssetPrim linkset, long bytesRead, long totalBytes) - { - Prims = new List(linkset.Children.Count + 1); - - Primitive parent = linkset.Parent.ToPrimitive(); - { - FacetedMesh mesh = null; - - if (parent.Sculpt == null || parent.Sculpt.SculptTexture == UUID.Zero) - mesh = Render.Plugin.GenerateFacetedMesh(parent, DetailLevel.Highest); - if (mesh != null) - LoadMesh(mesh, null); - } - - for (int i = 0; i < linkset.Children.Count; i++) - { - Primitive child = linkset.Children[i].ToPrimitive(); - FacetedMesh mesh = null; - - if (parent.Sculpt == null || child.Sculpt.SculptTexture == UUID.Zero) - mesh = Render.Plugin.GenerateFacetedMesh(child, DetailLevel.Highest); - if (mesh != null) - LoadMesh(mesh, null); - } - - PopulatePrimCombobox(); - - glControl.Invalidate(); - } - - private void LoadSculpt(string filename) - { - // Try to parse this as an image file - Image sculptTexture = Image.FromFile(filename); - - Primitive prim = new Primitive(); - prim.PrimData = ObjectManager.BuildBasicShape(PrimType.Sculpt); - prim.Sculpt = new Primitive.SculptData { SculptTexture = UUID.Random(), Type = SculptType.Sphere }; - prim.Textures = new Primitive.TextureEntry(UUID.Zero); - prim.Scale = Vector3.One * 3f; - - FacetedMesh mesh = Render.Plugin.GenerateFacetedSculptMesh(prim, (Bitmap)sculptTexture, DetailLevel.Highest); - if (mesh != null) - { - Prims = new List(1); - LoadMesh(mesh, null); - } - - glControl.Invalidate(); - } - - private void LoadPrimPackage(string filename) - { - string tempPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName()); - - try - { - // Create a temporary directory - Directory.CreateDirectory(tempPath); - - FastZip fastzip = new FastZip(); - fastzip.ExtractZip(filename, tempPath, String.Empty); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message); - return; - } - - // Check for the prims.xml file - string primsFile = System.IO.Path.Combine(tempPath, "prims.xml"); - if (!File.Exists(primsFile)) - { - MessageBox.Show("prims.xml not found in the archive"); - return; - } - - OSD osd = null; - - try { osd = OSDParser.DeserializeLLSDXml(File.ReadAllText(primsFile)); } - catch (Exception ex) { MessageBox.Show(ex.Message); } - - if (osd != null && osd.Type == OSDType.Map) - { - List primList = Helpers.OSDToPrimList(osd); - Prims = new List(primList.Count); - - for (int i = 0; i < primList.Count; i++) - { - Primitive prim = primList[i]; - FacetedMesh mesh = null; - - if (prim.Sculpt.SculptTexture != UUID.Zero) - { - Image sculptTexture = null; - if (LoadTexture(tempPath, prim.Sculpt.SculptTexture, ref sculptTexture)) - mesh = Render.Plugin.GenerateFacetedSculptMesh(prim, (Bitmap)sculptTexture, DetailLevel.Highest); - } - else - { - mesh = Render.Plugin.GenerateFacetedMesh(prim, DetailLevel.Highest); - } - - if (mesh != null) - LoadMesh(mesh, tempPath); - } - - // Setup the dropdown list of prims - PopulatePrimCombobox(); - - glControl.Invalidate(); - } - else - { - MessageBox.Show("Failed to load LLSD formatted primitive data from " + filename); - } - - Directory.Delete(tempPath); - } - - private void LoadMesh(FacetedMesh mesh, string basePath) - { - // Create a FaceData struct for each face that stores the 3D data - // in a Tao.OpenGL friendly format - for (int j = 0; j < mesh.Faces.Count; j++) - { - Face face = mesh.Faces[j]; - FaceData data = new FaceData(); - - // Vertices for this face - data.Vertices = new float[face.Vertices.Count * 3]; - for (int k = 0; k < face.Vertices.Count; k++) - { - data.Vertices[k * 3 + 0] = face.Vertices[k].Position.X; - data.Vertices[k * 3 + 1] = face.Vertices[k].Position.Y; - data.Vertices[k * 3 + 2] = face.Vertices[k].Position.Z; - } - - // Indices for this face - data.Indices = face.Indices.ToArray(); - - // Texture transform for this face - Primitive.TextureEntryFace teFace = mesh.Prim.Textures.GetFace((uint)j); - Render.Plugin.TransformTexCoords(face.Vertices, face.Center, teFace, mesh.Prim.Scale); - - // Texcoords for this face - data.TexCoords = new float[face.Vertices.Count * 2]; - for (int k = 0; k < face.Vertices.Count; k++) - { - data.TexCoords[k * 2 + 0] = face.Vertices[k].TexCoord.X; - data.TexCoords[k * 2 + 1] = face.Vertices[k].TexCoord.Y; - } - - // Texture for this face - if (!String.IsNullOrEmpty(basePath) && LoadTexture(basePath, teFace.TextureID, ref data.Texture)) - { - Bitmap bitmap = new Bitmap(data.Texture); - bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY); - Rectangle rectangle = new Rectangle(0, 0, bitmap.Width, bitmap.Height); - BitmapData bitmapData = bitmap.LockBits(rectangle, ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb); - - GL.GenTextures(1, out data.TexturePointer); - GL.BindTexture(TextureTarget.Texture2D, data.TexturePointer); - - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.LinearMipmapLinear); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)All.ClampToEdge); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)All.ClampToEdge); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.GenerateMipmap, 1); - - OpenTK.Graphics.Glu.Build2DMipmap(OpenTK.Graphics.TextureTarget.Texture2D, (int)OpenTK.Graphics.PixelInternalFormat.Rgb8, - bitmap.Width, bitmap.Height, OpenTK.Graphics.PixelFormat.Bgr, OpenTK.Graphics.PixelType.UnsignedByte, bitmapData.Scan0); - - bitmap.UnlockBits(bitmapData); - bitmap.Dispose(); - } - - // Set the UserData for this face to our FaceData struct - face.UserData = data; - mesh.Faces[j] = face; - } - - Prims.Add(mesh); - } - - private bool LoadTexture(string basePath, UUID textureID, ref System.Drawing.Image texture) - { - if (Textures.ContainsKey(textureID)) - { - texture = Textures[textureID]; - return true; - } - - string texturePath = System.IO.Path.Combine(basePath, textureID.ToString()); - - if (File.Exists(texturePath + ".tga")) - { - try - { - texture = (Image)LoadTGAClass.LoadTGA(texturePath + ".tga"); - Textures[textureID] = texture; - return true; - } - catch (Exception) - { - } - } - else if (File.Exists(texturePath + ".jp2")) - { - try - { - ManagedImage managedImage; - if (OpenJPEG.DecodeToImage(File.ReadAllBytes(texturePath + ".jp2"), out managedImage, out texture)) - { - Textures[textureID] = texture; - return true; - } - } - catch (Exception) - { - } - } - - return false; - } - - private void textureToolStripMenuItem_Click(object sender, EventArgs e) - { - picTexture.Image = null; - TexturePointers[0] = 0; - - OpenFileDialog dialog = new OpenFileDialog(); - - if (dialog.ShowDialog() == DialogResult.OK) - { - try - { - picTexture.Image = System.Drawing.Image.FromFile(dialog.FileName); - Bitmap bitmap = new Bitmap(picTexture.Image); - bitmap.RotateFlip(RotateFlipType.RotateNoneFlipY); - - // Create the GL texture space - GL.GenTextures(1, TexturePointers); - Rectangle rectangle = new Rectangle(0, 0, bitmap.Width, bitmap.Height); - BitmapData bitmapData = bitmap.LockBits(rectangle, ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format24bppRgb); - - GL.BindTexture(TextureTarget.Texture2D, TexturePointers[0]); - - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)All.LinearMipmapLinear); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)All.ClampToEdge); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)All.ClampToEdge); - GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.GenerateMipmap, 1); - - OpenTK.Graphics.Glu.Build2DMipmap(OpenTK.Graphics.TextureTarget.Texture2D, (int)OpenTK.Graphics.PixelInternalFormat.Rgb8, - bitmap.Width, bitmap.Height, OpenTK.Graphics.PixelFormat.Bgr, OpenTK.Graphics.PixelType.UnsignedByte, bitmapData.Scan0); - - bitmap.UnlockBits(bitmapData); - bitmap.Dispose(); - } - catch (Exception ex) - { - MessageBox.Show("Failed to load image from file " + dialog.FileName + ": " + ex.Message); - } - } - } - - private void savePrimXMLToolStripMenuItem_Click(object sender, EventArgs e) - { - - } - - private void saveTextureToolStripMenuItem_Click(object sender, EventArgs e) - { - - } - - private void oBJToolStripMenuItem_Click(object sender, EventArgs e) - { - SaveFileDialog dialog = new SaveFileDialog(); - dialog.Filter = "OBJ files (*.obj)|*.obj"; - - if (dialog.ShowDialog() == DialogResult.OK) - { - if (!MeshToOBJ.MeshesToOBJ(Prims, dialog.FileName)) - { - MessageBox.Show("Failed to save file " + dialog.FileName + - ". Ensure that you have permission to write to that file and it is currently not in use"); - } - } - } - - private void exitToolStripMenuItem_Click(object sender, EventArgs e) - { - Close(); - } - - private void aboutToolStripMenuItem_Click(object sender, EventArgs e) - { - MessageBox.Show( - "Written by John Hurliman (http://www.jhurliman.org/)"); - } - - #endregion Menu Callbacks - - #region Scrollbar Callbacks - - private void scroll_ValueChanged(object sender, EventArgs e) - { - glControl.Invalidate(); - } - - private void scrollZoom_ValueChanged(object sender, EventArgs e) - { - glControl_Resize(null, null); - glControl.Invalidate(); - } - - #endregion Scrollbar Callbacks - - #region PictureBox Callbacks - - private void picTexture_MouseDown(object sender, MouseEventArgs e) - { - DraggingTexture = true; - } - - private void picTexture_MouseUp(object sender, MouseEventArgs e) - { - DraggingTexture = false; - } - - private void picTexture_MouseLeave(object sender, EventArgs e) - { - DraggingTexture = false; - } - - private void picTexture_MouseMove(object sender, MouseEventArgs e) - { - if (DraggingTexture) - { - // What is the current action? - // None, DraggingEdge, DraggingCorner, DraggingWhole - } - else - { - // Check if the mouse is close to the edge or corner of a selection - // rectangle - - // If so, change the cursor accordingly - } - } - - private void picTexture_Paint(object sender, PaintEventArgs e) - { - // Draw the current selection rectangles - } - - #endregion PictureBox Callbacks - - private void cboPrim_SelectedIndexChanged(object sender, EventArgs e) - { - CurrentPrim = (FacetedMesh)cboPrim.Items[cboPrim.SelectedIndex]; - PopulateFaceCombobox(); - - glControl.Invalidate(); - } - - private void cboFace_SelectedIndexChanged(object sender, EventArgs e) - { - CurrentFace = (ProfileFace)cboFace.Items[cboFace.SelectedIndex]; - - glControl.Invalidate(); - } - - private void PopulatePrimCombobox() - { - cboPrim.Items.Clear(); - - if (Prims != null) - { - for (int i = 0; i < Prims.Count; i++) - cboPrim.Items.Add(Prims[i]); - } - - if (cboPrim.Items.Count > 0) - cboPrim.SelectedIndex = 0; - } - - private void PopulateFaceCombobox() - { - cboFace.Items.Clear(); - - if (CurrentPrim != null && CurrentPrim.Profile.Faces != null) - { - for (int i = 0; i < CurrentPrim.Profile.Faces.Count; i++) - cboFace.Items.Add(CurrentPrim.Profile.Faces[i]); - } - - if (cboFace.Items.Count > 0) - cboFace.SelectedIndex = 0; - } - - private void wireframeToolStripMenuItem_Click(object sender, EventArgs e) - { - wireframeToolStripMenuItem.Checked = !wireframeToolStripMenuItem.Checked; - Wireframe = wireframeToolStripMenuItem.Checked; - - glControl.Invalidate(); - } - - private void worldBrowserToolStripMenuItem_Click(object sender, EventArgs e) - { - frmBrowser browser = new frmBrowser(); - browser.ShowDialog(); - } - } - - public struct FaceData - { - public float[] Vertices; - public ushort[] Indices; - public float[] TexCoords; - public int TexturePointer; - public System.Drawing.Image Texture; - // TODO: Normals - } - - public static class Render - { - public static IRendering Plugin; - } -} diff --git a/Programs/PrimWorkshop/frmPrimWorkshop.resx b/Programs/PrimWorkshop/frmPrimWorkshop.resx deleted file mode 100644 index 01073880..00000000 --- a/Programs/PrimWorkshop/frmPrimWorkshop.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/Programs/PrimWorkshop/meshtoobj.cs b/Programs/PrimWorkshop/meshtoobj.cs deleted file mode 100644 index ed576999..00000000 --- a/Programs/PrimWorkshop/meshtoobj.cs +++ /dev/null @@ -1,174 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.IO; -using OpenMetaverse; -using OpenMetaverse.Rendering; - -namespace PrimWorkshop -{ - public static class MeshToOBJ - { - public static bool MeshesToOBJ(List meshes, string filename) - { - StringBuilder obj = new StringBuilder(); - StringBuilder mtl = new StringBuilder(); - - FileInfo objFileInfo = new FileInfo(filename); - - string mtlFilename = objFileInfo.FullName.Substring(objFileInfo.DirectoryName.Length + 1, - objFileInfo.FullName.Length - (objFileInfo.DirectoryName.Length + 1) - 4) + ".mtl"; - - obj.AppendLine("# Created by libOpenMetaverse"); - obj.AppendLine("mtllib ./" + mtlFilename); - obj.AppendLine(); - - mtl.AppendLine("# Created by libOpenMetaverse"); - mtl.AppendLine(); - - for (int i = 0; i < meshes.Count; i++) - { - FacetedMesh mesh = meshes[i]; - - for (int j = 0; j < mesh.Faces.Count; j++) - { - Face face = mesh.Faces[j]; - - if (face.Vertices.Count > 2) - { - string mtlName = String.Format("material{0}-{1}", i, face.ID); - Primitive.TextureEntryFace tex = face.TextureFace; - string texName = tex.TextureID.ToString() + ".tga"; - - // FIXME: Convert the source to TGA (if needed) and copy to the destination - - float shiny = 0.00f; - switch (tex.Shiny) - { - case Shininess.High: - shiny = 1.00f; - break; - case Shininess.Medium: - shiny = 0.66f; - break; - case Shininess.Low: - shiny = 0.33f; - break; - } - - mtl.AppendLine("newmtl " + mtlName); - mtl.AppendFormat("Ka {0} {1} {2}{3}", tex.RGBA.R, tex.RGBA.G, tex.RGBA.B, Environment.NewLine); - mtl.AppendFormat("Kd {0} {1} {2}{3}", tex.RGBA.R, tex.RGBA.G, tex.RGBA.B, Environment.NewLine); - //mtl.AppendFormat("Ks {0} {1} {2}{3}"); - mtl.AppendLine("Tr " + tex.RGBA.A); - mtl.AppendLine("Ns " + shiny); - mtl.AppendLine("illum 1"); - if (tex.TextureID != UUID.Zero && tex.TextureID != Primitive.TextureEntry.WHITE_TEXTURE) - mtl.AppendLine("map_Kd ./" + texName); - mtl.AppendLine(); - - #region Vertices - - for (int k = 0; k < face.Vertices.Count; k++) - { - Vertex vertex = face.Vertices[k]; - Vector3 pos = vertex.Position; - Vector3 norm = vertex.Normal; - Vector2 texc = vertex.TexCoord; - - // Apply scaling - pos *= mesh.Prim.Scale; - - // Apply rotation - pos *= mesh.Prim.Rotation; - - // The root prim position is sim-relative, while child prim positions are - // parent-relative. We want to apply parent-relative translations but not - // sim-relative ones - if (mesh.Prim.ParentID != 0) - pos += mesh.Prim.Position; - - // Normal - if (vertex.Normal.IsFinite()) - obj.AppendFormat("vn {0} {1} {2}{3}", - norm.X.ToString("N6"), - norm.Y.ToString("N6"), - norm.Z.ToString("N6"), - Environment.NewLine); - else - obj.AppendLine("vn 0.0 1.0 0.0"); - - // Texture Coord - obj.AppendFormat("vt {0} {1}{2}", - texc.X.ToString("N6"), - texc.Y.ToString("N6"), - Environment.NewLine); - - // Position - obj.AppendFormat("v {0} {1} {2}{3}", - pos.X.ToString("N6"), - pos.Y.ToString("N6"), - pos.Z.ToString("N6"), - Environment.NewLine); - } - obj.AppendLine(); - - #endregion Vertices - } - } - } - - int startOffset = 0; - - for (int i = 0; i < meshes.Count; i++) - { - FacetedMesh mesh = meshes[i]; - - for (int j = 0; j < mesh.Faces.Count; j++) - { - Face face = mesh.Faces[j]; - - if (face.Vertices.Count > 2) - { - //obj.AppendFormat("g face{0}-{1}{2}", i, face.ID, Environment.NewLine); - - string mtlName = String.Format("material{0}-{1}", i, face.ID); - //obj.AppendLine("usemtl " + mtlName); - - #region Elements - - // Write all of the faces (triangles) for this side - for (int k = 0; k < face.Indices.Count / 3; k++) - { - obj.AppendFormat("f {0}/{0}/{0} {1}/{1}/{1} {2}/{2}/{2}{3}", - startOffset + face.Indices[k * 3 + 0] + 1, - startOffset + face.Indices[k * 3 + 1] + 1, - startOffset + face.Indices[k * 3 + 2] + 1, - Environment.NewLine); - } - - obj.AppendFormat("# {0} faces{1}", face.Indices.Count / 3, Environment.NewLine); - obj.AppendLine(); - - for (int k = 0; k < face.Vertices.Count; k++) - ++startOffset; - - #endregion Elements - } - } - } - - try - { - File.WriteAllText(filename, obj.ToString()); - File.WriteAllText(mtlFilename, mtl.ToString()); - } - catch (Exception) - { - return false; - } - - return true; - } - } -} diff --git a/Programs/PrimWorkshop/packages.config b/Programs/PrimWorkshop/packages.config deleted file mode 100644 index b4c3de3b..00000000 --- a/Programs/PrimWorkshop/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/Programs/VisualParamGenerator/VisualParamGenerator.cs b/Programs/VisualParamGenerator/VisualParamGenerator.cs deleted file mode 100644 index cb88ed19..00000000 --- a/Programs/VisualParamGenerator/VisualParamGenerator.cs +++ /dev/null @@ -1,338 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Xml; - -namespace VisualParamGenerator -{ - class VisualParamGenerator - { - public static readonly System.Globalization.CultureInfo EnUsCulture = - new System.Globalization.CultureInfo("en-us"); - - static void Main(string[] args) - { - if (args.Length < 2) - { - Console.WriteLine("Usage: VisualParamGenerator.exe [template.cs] [_VisualParams_.cs]"); - return; - } - else if (!File.Exists(args[0])) - { - Console.WriteLine("Couldn't find file " + args[0]); - return; - } - - XmlNodeList list; - TextWriter writer; - - try - { - writer = new StreamWriter(args[1]); - } - catch (Exception) - { - Console.WriteLine("Couldn't open " + args[1] + " for writing"); - return; - } - - try - { - // Read in the template.cs file and write it to our output - TextReader reader = new StreamReader(args[0]); - writer.WriteLine(reader.ReadToEnd()); - reader.Close(); - } - catch (Exception) - { - Console.WriteLine("Couldn't read from file " + args[0]); - return; - } - - try - { - // Read in avatar_lad.xml - Stream stream = OpenMetaverse.Helpers.GetResourceStream("avatar_lad.xml"); - - if (stream != null) - { - StreamReader reader = new StreamReader(stream); - XmlDocument doc = new XmlDocument(); - doc.LoadXml(reader.ReadToEnd()); - list = doc.GetElementsByTagName("param"); - } - else - { - Console.WriteLine("Failed to load resource avatar_lad.xml. Are you missing a data folder?"); - return; - } - } - catch (Exception e) - { - Console.WriteLine(e.ToString()); - return; - } - - SortedList IDs = new SortedList(); - Dictionary Alphas = new Dictionary(); - Dictionary Colors = new Dictionary(); - - StringWriter output = new StringWriter(); - - // Make sure we end up with 251 Group-0 VisualParams as a sanity check - int count = 0; - - foreach (XmlNode node in list) - { - if (node.Attributes["group"] == null) - { - // Sanity check that a group is assigned - Console.WriteLine("Encountered a param with no group set!"); - continue; - } - if ((node.Attributes["shared"] != null) && (node.Attributes["shared"].Value.Equals("1"))) - { - // This param will have been already been defined - continue; - } - if ((node.Attributes["edit_group"] == null)) - { - // This param is calculated by the client based on other params - continue; - } - - // Confirm this is a valid VisualParam - if (node.Attributes["id"] != null && - node.Attributes["name"] != null) - { - try - { - int id = Int32.Parse(node.Attributes["id"].Value); - - string bumpAttrib = "false"; - bool skipColor = false; - - if (node.ParentNode.Name == "layer") - { - if (node.ParentNode.Attributes["render_pass"] != null && node.ParentNode.Attributes["render_pass"].Value == "bump") - { - bumpAttrib = "true"; - } - - for (int nodeNr = 0; nodeNr < node.ParentNode.ChildNodes.Count; nodeNr++) - { - XmlNode lnode = node.ParentNode.ChildNodes[nodeNr]; - - if (lnode.Name == "texture") - { - if (lnode.Attributes["local_texture_alpha_only"] != null && lnode.Attributes["local_texture_alpha_only"].Value.ToLower() == "true") - { - skipColor = true; - } - } - } - } - - - if (node.HasChildNodes) - { - for (int nodeNr = 0; nodeNr < node.ChildNodes.Count; nodeNr++) - { - #region Alpha mask and bumps - if (node.ChildNodes[nodeNr].Name == "param_alpha") - { - XmlNode anode = node.ChildNodes[nodeNr]; - string tga_file = "string.Empty"; - string skip_if_zero = "false"; - string multiply_blend = "false"; - string domain = "0"; - - if (anode.Attributes["domain"] != null) - domain = anode.Attributes["domain"].Value; - - if (anode.Attributes["tga_file"] != null) - tga_file = string.Format("\"{0}\"", anode.Attributes["tga_file"].Value); ; - - if (anode.Attributes["skip_if_zero"] != null && anode.Attributes["skip_if_zero"].Value.ToLower() == "true") - skip_if_zero = "true"; - - if (anode.Attributes["multiply_blend"] != null && anode.Attributes["multiply_blend"].Value.ToLower() == "true") - multiply_blend = "true"; - - Alphas.Add(id, string.Format("new VisualAlphaParam({0}f, {1}, {2}, {3})", domain, tga_file, skip_if_zero, multiply_blend)); - } - #endregion - #region Colors - else if (node.ChildNodes[nodeNr].Name == "param_color" && node.ChildNodes[nodeNr].HasChildNodes) - { - XmlNode cnode = node.ChildNodes[nodeNr]; - string operation = "VisualColorOperation.Add"; - List colors = new List(); - - if (cnode.Attributes["operation"] != null) - { - - switch (cnode.Attributes["operation"].Value) - { - case "blend": - operation = "VisualColorOperation.Blend"; - break; - - case "multiply": - operation = "VisualColorOperation.Blend"; - break; - } - } - - foreach (XmlNode cvalue in cnode.ChildNodes) - { - if (cvalue.Name == "value" && cvalue.Attributes["color"] != null) - { - Match m = Regex.Match(cvalue.Attributes["color"].Value, @"((?\d+)(?:, *)?){4}"); - if (!m.Success) - { - continue; - } - CaptureCollection val = m.Groups["val"].Captures; - colors.Add(string.Format("new Color4({0}, {1}, {2}, {3})", val[0], val[1], val[2], val[3])); - } - } - - if (colors.Count > 0 && !skipColor) - { - string colorsStr = string.Join(", ", colors.ToArray()); - Colors.Add(id, string.Format("new VisualColorParam({0}, new Color4[] {{ {1} }})", operation, colorsStr)); - } - } - #endregion - - } - } - - // Check for duplicates - if (IDs.ContainsKey(id)) - continue; - - string name = node.Attributes["name"].Value; - int group = Int32.Parse(node.Attributes["group"].Value); - - string wearable = "null"; - if (node.Attributes["wearable"] != null) - wearable = "\"" + node.Attributes["wearable"].Value + "\""; - - string label = "String.Empty"; - if (node.Attributes["label"] != null) - label = "\"" + node.Attributes["label"].Value + "\""; - - string label_min = "String.Empty"; - if (node.Attributes["label_min"] != null) - label_min = "\"" + node.Attributes["label_min"].Value + "\""; - - string label_max = "String.Empty"; - if (node.Attributes["label_max"] != null) - label_max = "\"" + node.Attributes["label_max"].Value + "\""; - - float min = Single.Parse(node.Attributes["value_min"].Value, - System.Globalization.NumberStyles.Float, EnUsCulture.NumberFormat); - float max = Single.Parse(node.Attributes["value_max"].Value, - System.Globalization.NumberStyles.Float, EnUsCulture.NumberFormat); - - float def; - if (node.Attributes["value_default"] != null) - def = Single.Parse(node.Attributes["value_default"].Value, - System.Globalization.NumberStyles.Float, EnUsCulture.NumberFormat); - else - def = min; - - string drivers = "null"; - if (node.HasChildNodes) - { - for (int nodeNr = 0; nodeNr < node.ChildNodes.Count; nodeNr++) - { - XmlNode cnode = node.ChildNodes[nodeNr]; - - if (cnode.Name == "param_driver" && cnode.HasChildNodes) - { - List driverIDs = new List(); - foreach (XmlNode dnode in cnode.ChildNodes) - { - if (dnode.Name == "driven" && dnode.Attributes["id"] != null) - { - driverIDs.Add(dnode.Attributes["id"].Value); - } - } - - if (driverIDs.Count > 0) - { - drivers = string.Format("new int[] {{ {0} }}", string.Join(", ", driverIDs.ToArray())); - } - - } - } - } - - IDs.Add(id, - String.Format(" Params[{0}] = new VisualParam({0}, \"{1}\", {2}, {3}, {4}, {5}, {6}, {7}f, {8}f, {9}f, {10}, {11}, ", - id, name, group, wearable, label, label_min, label_max, def, min, max, bumpAttrib, drivers)); - - if (group == 0) - ++count; - } - catch (Exception e) - { - Console.WriteLine(e.ToString()); - } - } - } - - if (count != 251) - { - Console.WriteLine("Ended up with the wrong number of Group-0 VisualParams! Exiting..."); - return; - } - - // Now that we've collected all the entries and sorted them, add them to our output buffer - foreach (KeyValuePair line in IDs) - { - output.Write(line.Value); - - if (Alphas.ContainsKey(line.Key)) - { - output.Write(Alphas[line.Key] + ", "); - } - else - { - output.Write("null, "); - } - - if (Colors.ContainsKey(line.Key)) - { - output.Write(Colors[line.Key]); - } - else - { - output.Write("null"); - } - - - output.WriteLine(");"); - } - - output.Write(" }" + Environment.NewLine); - output.Write(" }" + Environment.NewLine); - output.Write("}" + Environment.NewLine); - - try - { - writer.Write(output.ToString()); - writer.Close(); - } - catch (Exception e) - { - Console.WriteLine(e.ToString()); - } - } - } -} diff --git a/Programs/VisualParamGenerator/VisualParamGenerator.csproj b/Programs/VisualParamGenerator/VisualParamGenerator.csproj deleted file mode 100644 index fbc7e314..00000000 --- a/Programs/VisualParamGenerator/VisualParamGenerator.csproj +++ /dev/null @@ -1,101 +0,0 @@ - - - Local - 14.0.25123 - 2.0 - {CF93CDA8-0000-0000-0000-000000000000} - Debug - - - - VisualParamGenerator - JScript - Grid - IE50 - false - v4.0 - Exe - - VisualParamGenerator - - - - - - - True - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\bin\ - False - False - False - 4 - False - 1591,1574,0419 - AnyCPU - - - True - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\bin\ - False - False - False - 4 - False - 1591,1574,0419 - AnyCPU - - - - System - False - - - System.Xml - False - - - - - LibreMetaverse - {27C70F3A-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - LibreMetaverseTypes - {B37B02AD-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - - - - - - - - diff --git a/Programs/VisualParamGenerator/template.cs b/Programs/VisualParamGenerator/template.cs deleted file mode 100644 index eb829d9b..00000000 --- a/Programs/VisualParamGenerator/template.cs +++ /dev/null @@ -1,155 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OpenMetaverse -{ - /// - /// Operation to apply when applying color to texture - /// - public enum VisualColorOperation - { - Add, - Blend, - Multiply - } - - /// - /// Information needed to translate visual param value to RGBA color - /// - public struct VisualColorParam - { - public VisualColorOperation Operation; - public Color4[] Colors; - - /// - /// Construct VisualColorParam - /// - /// Operation to apply when applying color to texture - /// Colors - public VisualColorParam(VisualColorOperation operation, Color4[] colors) - { - Operation = operation; - Colors = colors; - } - } - - /// - /// Represents alpha blending and bump infor for a visual parameter - /// such as sleive length - /// - public struct VisualAlphaParam - { - /// Stregth of the alpha to apply - public float Domain; - - /// File containing the alpha channel - public string TGAFile; - - /// Skip blending if parameter value is 0 - public bool SkipIfZero; - - /// Use miltiply insted of alpha blending - public bool MultiplyBlend; - - /// - /// Create new alhpa information for a visual param - /// - /// Stregth of the alpha to apply - /// File containing the alpha channel - /// Skip blending if parameter value is 0 - /// Use miltiply insted of alpha blending - public VisualAlphaParam(float domain, string tgaFile, bool skipIfZero, bool multiplyBlend) - { - Domain = domain; - TGAFile = tgaFile; - SkipIfZero = skipIfZero; - MultiplyBlend = multiplyBlend; - } - } - /// - /// A single visual characteristic of an avatar mesh, such as eyebrow height - /// - public struct VisualParam - { - /// Index of this visual param - public int ParamID; - /// Internal name - public string Name; - /// Group ID this parameter belongs to - public int Group; - /// Name of the wearable this parameter belongs to - public string Wearable; - /// Displayable label of this characteristic - public string Label; - /// Displayable label for the minimum value of this characteristic - public string LabelMin; - /// Displayable label for the maximum value of this characteristic - public string LabelMax; - /// Default value - public float DefaultValue; - /// Minimum value - public float MinValue; - /// Maximum value - public float MaxValue; - /// Is this param used for creation of bump layer? - public bool IsBumpAttribute; - /// Alpha blending/bump info - public VisualAlphaParam? AlphaParams; - /// Color information - public VisualColorParam? ColorParams; - /// Array of param IDs that are drivers for this parameter - public int[] Drivers; - /// - /// Set all the values through the constructor - /// - /// Index of this visual param - /// Internal name - /// - /// - /// Displayable label of this characteristic - /// Displayable label for the minimum value of this characteristic - /// Displayable label for the maximum value of this characteristic - /// Default value - /// Minimum value - /// Maximum value - /// Is this param used for creation of bump layer? - /// Array of param IDs that are drivers for this parameter - /// Alpha blending/bump info - /// Color information - public VisualParam(int paramID, string name, int group, string wearable, string label, string labelMin, string labelMax, float def, float min, float max, bool isBumpAttribute, int[] drivers, VisualAlphaParam? alpha, VisualColorParam? colorParams) - { - ParamID = paramID; - Name = name; - Group = group; - Wearable = wearable; - Label = label; - LabelMin = labelMin; - LabelMax = labelMax; - DefaultValue = def; - MaxValue = max; - MinValue = min; - IsBumpAttribute = isBumpAttribute; - Drivers = drivers; - AlphaParams = alpha; - ColorParams = colorParams; - } - } - - /// - /// Holds the Params array of all the avatar appearance parameters - /// - public static class VisualParams - { - public static SortedList Params = new SortedList(); - - public static VisualParam Find(string name, string wearable) - { - foreach (KeyValuePair param in Params) - if (param.Value.Name == name && param.Value.Wearable == wearable) - return param.Value; - - return new VisualParam(); - } - - static VisualParams() - { \ No newline at end of file diff --git a/Programs/importprimscript/importprimscript.cs b/Programs/importprimscript/importprimscript.cs deleted file mode 100644 index b7d34391..00000000 --- a/Programs/importprimscript/importprimscript.cs +++ /dev/null @@ -1,383 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Threading; -using System.IO; -using System.Drawing; -using System.Globalization; -using OpenMetaverse; -using OpenMetaverse.Http; -using OpenMetaverse.Imaging; - -namespace importprimscript -{ - class Sculpt - { - public string Name; - public string TextureFile; - public UUID TextureID; - public string SculptFile; - public UUID SculptID; - public Vector3 Scale; - public Vector3 Offset; - } - - class importprimscript - { - static GridClient Client = new GridClient(); - static Sculpt CurrentSculpt = null; - static AutoResetEvent RezzedEvent = new AutoResetEvent(false); - static Vector3 RootPosition = Vector3.Zero; - static List RezzedPrims = new List(); - static UUID UploadFolderID = UUID.Zero; - - static void Main(string[] args) - { - if (args.Length != 8 && args.Length != 9) - { - Console.WriteLine("Usage: importprimscript.exe [firstname] [lastname] [password] " + - "[loginuri] [Simulator] [x] [y] [z] [input.primscript]" + - Environment.NewLine + "Example: importprimscript.exe My Bot password " + - "Hooper 128 128 40 maya-export" + Path.DirectorySeparatorChar + "ant.primscript" + - Environment.NewLine + "(the loginuri is optional and only used for logging in to another grid)"); - Environment.Exit(-1); - } - - // Strip quotes from any arguments - for (int i = 0; i < args.Length; i++) - args[i] = args[i].Trim(new char[] { '"' }); - - // Parse the primscript file - string scriptfilename = args[args.Length - 1]; - string error; - List sculpties = ParsePrimscript(scriptfilename, out error); - scriptfilename = Path.GetFileNameWithoutExtension(scriptfilename); - - // Check for parsing errors - if (error != String.Empty) - { - Console.WriteLine("An error was encountered reading the input file: " + error); - Environment.Exit(-2); - } - else if (sculpties.Count == 0) - { - Console.WriteLine("No primitives were read from the input file"); - Environment.Exit(-3); - } - - // Add callback handlers for asset uploads finishing. new prims spotted, and logging - Client.Objects.ObjectUpdate += new EventHandler(Objects_OnNewPrim); - Logger.OnLogMessage += new Logger.LogCallback(Client_OnLogMessage); - - // Optimize the connection for our purposes - Client.Self.Movement.Camera.Far = 64f; - Client.Settings.MULTIPLE_SIMS = false; - Client.Settings.SEND_AGENT_UPDATES = true; - Settings.LOG_LEVEL = Helpers.LogLevel.None; - Client.Settings.ALWAYS_REQUEST_OBJECTS = true; - Client.Settings.ALWAYS_DECODE_OBJECTS = true; - Client.Settings.THROTTLE_OUTGOING_PACKETS = false; - Client.Throttle.Land = 0; - Client.Throttle.Wind = 0; - Client.Throttle.Cloud = 0; - // Not sure if Asset or Texture will help with uploads, but it won't hurt - Client.Throttle.Asset = 220000.0f; - Client.Throttle.Texture = 446000.0f; - Client.Throttle.Task = 446000.0f; - - // Create a handler for the event queue connecting, so we know when - // it is safe to start uploading - AutoResetEvent eventQueueEvent = new AutoResetEvent(false); - EventHandler eventQueueCallback = - delegate(object sender, EventQueueRunningEventArgs e) - { - if (e.Simulator == Client.Network.CurrentSim) - eventQueueEvent.Set(); - }; - - Client.Network.EventQueueRunning += eventQueueCallback; - - int x = Int32.Parse(args[args.Length - 4]); - int y = Int32.Parse(args[args.Length - 3]); - int z = Int32.Parse(args[args.Length - 2]); - string start = NetworkManager.StartLocation(args[args.Length - 5], x, y, z); - - LoginParams loginParams = Client.Network.DefaultLoginParams(args[0], args[1], args[2], - "importprimscript", "1.4.0"); - loginParams.Start = start; - if (args.Length == 9) loginParams.URI = args[3]; - - // Attempt to login - if (!Client.Network.Login(loginParams)) - { - Console.WriteLine("Login failed: " + Client.Network.LoginMessage); - Environment.Exit(-4); - } - - // Need to be connected to the event queue before we can upload - Console.WriteLine("Login succeeded, waiting for the event handler to connect..."); - if (!eventQueueEvent.WaitOne(1000 * 90, false)) - { - Console.WriteLine("Event queue connection timed out, disconnecting..."); - Client.Network.Logout(); - Environment.Exit(-5); - } - - // Don't need this anymore - Client.Network.EventQueueRunning -= eventQueueCallback; - - // Set the root position for the import - RootPosition = Client.Self.SimPosition; - RootPosition.Z += 3.0f; - - // TODO: Check if our account balance is high enough to upload everything - // - - // Create a folder to hold all of our texture uploads - UploadFolderID = Client.Inventory.CreateFolder(Client.Inventory.Store.RootFolder.UUID, scriptfilename); - - // Loop through each sculpty and do what we need to do - for (int i = 0; i < sculpties.Count; i++) - { - // Upload the sculpt map and texture - sculpties[i].SculptID = UploadImage(sculpties[i].SculptFile, true); - sculpties[i].TextureID = UploadImage(sculpties[i].TextureFile, false); - - // Check for failed uploads - if (sculpties[i].SculptID == UUID.Zero) - { - Console.WriteLine("Sculpt map " + sculpties[i].SculptFile + " failed to upload, skipping " + sculpties[i].Name); - continue; - } - else if (sculpties[i].TextureID == UUID.Zero) - { - Console.WriteLine("Texture " + sculpties[i].TextureFile + " failed to upload, skipping " + sculpties[i].Name); - continue; - } - - // Create basic spherical volume parameters. It will be set to - // a scultpy in the callback for new objects being created - Primitive.ConstructionData volume = new Primitive.ConstructionData(); - volume.PCode = PCode.Prim; - volume.Material = Material.Wood; - volume.PathScaleY = 0.5f; - volume.PathCurve = PathCurve.Circle; - volume.ProfileCurve = ProfileCurve.Circle; - - // Rez this prim - CurrentSculpt = sculpties[i]; - Client.Objects.AddPrim(Client.Network.CurrentSim, volume, UUID.Zero, - RootPosition + CurrentSculpt.Offset, CurrentSculpt.Scale, Quaternion.Identity); - - // Wait for the prim to rez and the properties be set for it - if (!RezzedEvent.WaitOne(1000 * 10, false)) - { - Console.WriteLine("Timed out waiting for prim " + CurrentSculpt.Name + " to rez, skipping"); - continue; - } - } - - CurrentSculpt = null; - - lock (RezzedPrims) - { - // Set full permissions for all of the objects - Client.Objects.SetPermissions(Client.Network.CurrentSim, RezzedPrims, PermissionWho.All, - PermissionMask.All, true); - - // Link the entire object together - Client.Objects.LinkPrims(Client.Network.CurrentSim, RezzedPrims); - } - - Console.WriteLine("Rezzed, textured, and linked " + RezzedPrims.Count + " sculpted prims, logging out..."); - - Client.Network.Logout(); - } - - static void Client_OnLogMessage(object message, Helpers.LogLevel level) - { - if (level >= Helpers.LogLevel.Warning) - Console.WriteLine(level + ": " + message); - } - - static UUID UploadImage(string filename, bool lossless) - { - UUID newAssetID = UUID.Zero; - byte[] jp2data = null; - - try - { - Bitmap image = (Bitmap)Bitmap.FromFile(filename); - jp2data = OpenJPEG.EncodeFromImage(image, lossless); - } - catch (Exception ex) - { - Console.WriteLine("Failed to encode image file " + filename + ": " + ex.ToString()); - return UUID.Zero; - } - - AutoResetEvent uploadEvent = new AutoResetEvent(false); - Client.Inventory.RequestCreateItemFromAsset(jp2data, Path.GetFileNameWithoutExtension(filename), - "Uploaded with importprimscript", AssetType.Texture, InventoryType.Texture, UploadFolderID, - delegate(bool success, string status, UUID itemID, UUID assetID) - { - if (success) - { - Console.WriteLine("Finished uploading image " + filename + ", AssetID: " + assetID.ToString()); - newAssetID = assetID; - } - else - { - Console.WriteLine("Failed to upload image file " + filename + ": " + status); - } - - uploadEvent.Set(); - } - ); - - // The images are small, 60 seconds should be plenty - uploadEvent.WaitOne(1000 * 60, false); - - return newAssetID; - } - - static void Objects_OnNewPrim(object sender, PrimEventArgs e) - { - Primitive prim = e.Prim; - if (CurrentSculpt != null && (prim.Flags & PrimFlags.CreateSelected) != 0 && - !RezzedPrims.Contains(prim.LocalID)) - { - lock (RezzedPrims) RezzedPrims.Add(prim.LocalID); - - Console.WriteLine("Rezzed prim " + CurrentSculpt.Name + ", setting properties"); - - // Deselect the prim - Client.Objects.DeselectObject(Client.Network.CurrentSim, prim.LocalID); - - // Set the prim position - Client.Objects.SetPosition(Client.Network.CurrentSim, prim.LocalID, - RootPosition + CurrentSculpt.Offset); - - // Set the texture - Primitive.TextureEntry textures = new Primitive.TextureEntry(CurrentSculpt.TextureID); - Client.Objects.SetTextures(Client.Network.CurrentSim, prim.LocalID, textures); - - // Turn it in to a sculpted prim - Primitive.SculptData sculpt = new Primitive.SculptData(); - sculpt.SculptTexture = CurrentSculpt.SculptID; - sculpt.Type = SculptType.Sphere; - Client.Objects.SetSculpt(Client.Network.CurrentSim, prim.LocalID, sculpt); - - // Set the prim name - if (!String.IsNullOrEmpty(CurrentSculpt.Name)) - Client.Objects.SetName(Client.Network.CurrentSim, prim.LocalID, CurrentSculpt.Name); - - RezzedEvent.Set(); - } - } - - static List ParsePrimscript(string primscriptfile, out string error) - { - string line; - Sculpt current = null; - List sculpties = new List(); - error = String.Empty; - StreamReader primscript = null; - - // Parse a directory out of the primscriptfile string, if one exists - string path = Path.GetDirectoryName(primscriptfile); - if (!String.IsNullOrEmpty(path)) - path += Path.DirectorySeparatorChar; - else - path = String.Empty; - - try - { - primscript = File.OpenText(primscriptfile); - - while ((line = primscript.ReadLine()) != null) - { - string[] words = line.Split(new char[] { ' ' }); - - if (words.Length > 0) - { - if (current != null) - { - switch (words[0]) - { - case "newPrim": - if (current.Scale != Vector3.Zero && - !String.IsNullOrEmpty(current.SculptFile) && - !String.IsNullOrEmpty(current.TextureFile)) - { - // Add the previous prim to the list as it is now finalized - sculpties.Add(current); - } - - // Start a new prim - current = new Sculpt(); - - break; - case "prim": - // The only useful bit of information here is the prim name - if (words.Length >= 3) - current.Name = words[2]; - break; - case "shape": - // This line has the name of the sculpt texture - if (words.Length >= 3) - current.SculptFile = path + words[2] + ".bmp"; - break; - case "texture": - // This line has the name of the actual texture - if (words.Length >= 3) - current.TextureFile = path + words[2] + ".bmp"; - break; - case "transform": - // Get some primitive params - if (words.Length >= 9) - { - float x, y, z; - x = Single.Parse(words[2], CultureInfo.InvariantCulture); - y = Single.Parse(words[3], CultureInfo.InvariantCulture); - z = Single.Parse(words[4], CultureInfo.InvariantCulture); - current.Scale = new Vector3(x, y, z); - - x = Single.Parse(words[6], CultureInfo.InvariantCulture); - y = Single.Parse(words[7], CultureInfo.InvariantCulture); - z = Single.Parse(words[8], CultureInfo.InvariantCulture); - current.Offset = new Vector3(x, y, z); - } - break; - } - } - else if (words[0] == "newPrim") - { - // Start a new prim - current = new Sculpt(); - } - } - } - - // Add the final prim - if (current != null && current.Scale != Vector3.Zero && - !String.IsNullOrEmpty(current.SculptFile) && - !String.IsNullOrEmpty(current.TextureFile)) - { - // Add the previous prim to the list as it is now finalized - sculpties.Add(current); - } - } - catch (Exception ex) - { - error = ex.ToString(); - } - finally - { - if (primscript != null) - primscript.Close(); - } - - return sculpties; - } - } -} diff --git a/Programs/importprimscript/importprimscript.csproj b/Programs/importprimscript/importprimscript.csproj deleted file mode 100644 index f0f6f424..00000000 --- a/Programs/importprimscript/importprimscript.csproj +++ /dev/null @@ -1,101 +0,0 @@ - - - Local - 14.0.25123 - 2.0 - {95C06600-0000-0000-0000-000000000000} - Debug - - - - importprimscript - JScript - Grid - IE50 - false - v4.0 - Exe - - importprimscript - - - - - - - True - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\bin\ - False - False - False - 4 - False - 1591,1574,0419 - AnyCPU - - - True - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\bin\ - False - False - False - 4 - False - 1591,1574,0419 - AnyCPU - - - - System - False - - - System.Drawing - False - - - - - LibreMetaverse - {27C70F3A-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - LibreMetaverseTypes - {B37B02AD-0000-0000-0000-000000000000} - {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - False - - - - - Code - - - - - - - - - - diff --git a/Programs/mapgenerator/ProtocolManager.cs b/Programs/mapgenerator/ProtocolManager.cs deleted file mode 100644 index 9653fd2f..00000000 --- a/Programs/mapgenerator/ProtocolManager.cs +++ /dev/null @@ -1,694 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace mapgenerator -{ - /// - /// - /// - public enum PacketFrequency - { - /// - Low, - /// - Medium, - /// - High - } - - /// - /// - /// - public enum FieldType - { - /// - U8, - /// - U16, - /// - U32, - /// - U64, - /// - S8, - /// - S16, - /// - S32, - /// - F32, - /// - F64, - /// - LLUUID, - /// - BOOL, - /// - LLVector3, - /// - LLVector3d, - /// - LLVector4, - /// - LLQuaternion, - /// - IPADDR, - /// - IPPORT, - /// - Variable, - /// - Fixed, - /// - Single, - /// - Multiple - } - - /// - /// - /// - public class MapField : IComparable - { - /// - public int KeywordPosition; - /// - public string Name; - /// - public FieldType Type; - /// - public int Count; - - /// - /// - /// - /// - /// - public int CompareTo(object obj) - { - MapField temp = (MapField)obj; - - if (this.KeywordPosition > temp.KeywordPosition) - { - return 1; - } - else - { - if(temp.KeywordPosition == this.KeywordPosition) - { - return 0; - } - else - { - return -1; - } - } - } - } - - /// - /// - /// - public class MapBlock : IComparable - { - /// - public int KeywordPosition; - /// - public string Name; - /// - public int Count; - /// - public List Fields; - - /// - /// - /// - /// - /// - public int CompareTo(object obj) - { - MapBlock temp = (MapBlock)obj; - - if (this.KeywordPosition > temp.KeywordPosition) - { - return 1; - } - else - { - if(temp.KeywordPosition == this.KeywordPosition) - { - return 0; - } - else - { - return -1; - } - } - } - } - - /// - /// - /// - public class MapPacket - { - /// - public ushort ID; - /// - public string Name; - /// - public PacketFrequency Frequency; - /// - public bool Trusted; - /// - public bool Encoded; - /// - public List Blocks; - } - - /// - /// - /// - public class ProtocolManager - { - /// - public Dictionary TypeSizes; - /// - public Dictionary KeywordPositions; - /// - public MapPacket[] LowMaps; - /// - public MapPacket[] MediumMaps; - /// - public MapPacket[] HighMaps; - - /// - /// - /// - /// - /// - /// - public ProtocolManager(string mapFile) - { - // Initialize the map arrays - LowMaps = new MapPacket[65536]; - MediumMaps = new MapPacket[256]; - HighMaps = new MapPacket[256]; - - // Build the type size hash table - TypeSizes = new Dictionary(); - TypeSizes.Add(FieldType.U8, 1); - TypeSizes.Add(FieldType.U16, 2); - TypeSizes.Add(FieldType.U32, 4); - TypeSizes.Add(FieldType.U64, 8); - TypeSizes.Add(FieldType.S8, 1); - TypeSizes.Add(FieldType.S16, 2); - TypeSizes.Add(FieldType.S32, 4); - TypeSizes.Add(FieldType.F32, 4); - TypeSizes.Add(FieldType.F64, 8); - TypeSizes.Add(FieldType.LLUUID, 16); - TypeSizes.Add(FieldType.BOOL, 1); - TypeSizes.Add(FieldType.LLVector3, 12); - TypeSizes.Add(FieldType.LLVector3d, 24); - TypeSizes.Add(FieldType.LLVector4, 16); - TypeSizes.Add(FieldType.LLQuaternion, 16); - TypeSizes.Add(FieldType.IPADDR, 4); - TypeSizes.Add(FieldType.IPPORT, 2); - TypeSizes.Add(FieldType.Variable, -1); - TypeSizes.Add(FieldType.Fixed, -2); - - KeywordPositions = new Dictionary(); - LoadMapFile(mapFile); - } - - /// - /// - /// - /// - /// - public MapPacket Command(string command) - { - foreach (MapPacket map in HighMaps) - { - if (map != null) - { - if (command == map.Name) - { - return map; - } - } - } - - foreach (MapPacket map in MediumMaps) - { - if (map != null) - { - if (command == map.Name) - { - return map; - } - } - } - - foreach (MapPacket map in LowMaps) - { - if (map != null) - { - if (command == map.Name) - { - return map; - } - } - } - - throw new Exception("Cannot find map for command \"" + command + "\""); - } - - /// - /// - /// - /// - /// - public MapPacket Command(byte[] data) - { - ushort command; - - if (data.Length < 5) - { - return null; - } - - if (data[4] == 0xFF) - { - if ((byte)data[5] == 0xFF) - { - // Low frequency - command = (ushort)(data[6] * 256 + data[7]); - return Command(command, PacketFrequency.Low); - } - else - { - // Medium frequency - command = (ushort)data[5]; - return Command(command, PacketFrequency.Medium); - } - } - else - { - // High frequency - command = (ushort)data[4]; - return Command(command, PacketFrequency.High); - } - } - - /// - /// - /// - /// - /// - /// - public MapPacket Command(ushort command, PacketFrequency frequency) - { - switch (frequency) - { - case PacketFrequency.High: - return HighMaps[command]; - case PacketFrequency.Medium: - return MediumMaps[command]; - case PacketFrequency.Low: - return LowMaps[command]; - } - - throw new Exception("Cannot find map for command \"" + command + "\" with frequency \"" + frequency + "\""); - } - - /// - /// - /// - public void PrintMap(TextWriter writer) - { - PrintOneMap(writer, LowMaps, "Low "); - PrintOneMap(writer, MediumMaps, "Medium"); - PrintOneMap(writer, HighMaps, "High "); - } - - /// - /// - /// - /// - /// - private void PrintOneMap(TextWriter writer, MapPacket[] map, string frequency) { - int i; - - for (i = 0; i < map.Length; ++i) - { - if (map[i] != null) - { - writer.WriteLine("{0} {1,5} - {2} - {3} - {4}", frequency, i, map[i].Name, - map[i].Trusted ? "Trusted" : "Untrusted", - map[i].Encoded ? "Zerocoded" : "Unencoded"); - - foreach (MapBlock block in map[i].Blocks) - { - if (block.Count == -1) - { - writer.WriteLine("\t{0,4} {1} (Variable)", block.KeywordPosition, block.Name); - } - else - { - writer.WriteLine("\t{0,4} {1} ({2})", block.KeywordPosition, block.Name, block.Count); - } - - foreach (MapField field in block.Fields) - { - writer.WriteLine("\t\t{0,4} {1} ({2} / {3})", field.KeywordPosition, field.Name, - field.Type, field.Count); - } - } - } - } - } - - /// - /// - /// - /// - /// - public static void DecodeMapFile(string mapFile, string outputFile) - { - byte magicKey = 0; - byte[] buffer = new byte[2048]; - int nread; - BinaryReader map; - BinaryWriter output; - - try - { - map = new BinaryReader(new FileStream(mapFile, FileMode.Open)); - } - catch(Exception e) - { - throw new Exception("Map file error", e); - } - - try - { - output = new BinaryWriter(new FileStream(outputFile, FileMode.CreateNew)); - } - catch(Exception e) - { - throw new Exception("Map file error", e); - } - - while ((nread = map.Read(buffer, 0, 2048)) != 0) - { - for (int i = 0; i < nread; ++i) - { - buffer[i] ^= magicKey; - magicKey += 43; - } - - output.Write(buffer, 0, nread); - } - - map.Close(); - output.Close(); - } - - /// - /// - /// - /// - private void LoadMapFile(string mapFile) - { - FileStream map; - - // Load the protocol map file - try - { - map = new FileStream(mapFile, FileMode.Open, FileAccess.Read); - } - catch(Exception e) - { - throw new Exception("Map file error", e); - } - - try - { - StreamReader r = new StreamReader(map); - r.BaseStream.Seek(0, SeekOrigin.Begin); - string newline; - string trimmedline; - bool inPacket = false; - bool inBlock = false; - MapPacket currentPacket = null; - MapBlock currentBlock = null; - char[] trimArray = new char[] {' ', '\t'}; - - // While not at the end of the file - while (r.Peek() > -1) - { - #region ParseMap - - newline = r.ReadLine(); - trimmedline = System.Text.RegularExpressions.Regex.Replace(newline, @"\s+", " "); - trimmedline = trimmedline.Trim(trimArray); - - if (!inPacket) - { - // Outside of all packet blocks - - if (trimmedline == "{") - { - inPacket = true; - } - } - else - { - // Inside of a packet block - - if (!inBlock) - { - // Inside a packet block, outside of the blocks - - if (trimmedline == "{") - { - inBlock = true; - } - else if (trimmedline == "}") - { - // Reached the end of the packet - // currentPacket.Blocks.Sort(); - inPacket = false; - } - else - { - // Skip comments - if (trimmedline.StartsWith("//")) continue; - - // The packet header - #region ParsePacketHeader - - // Splice the string in to tokens - string[] tokens = trimmedline.Split(new char[] {' ', '\t'}); - - if (tokens.Length > 3) - { - //Hash packet name to insure correct keyword ordering - KeywordPosition(tokens[0]); - - uint packetID; - - // Remove the leading "0x" - if (tokens[2].Length > 2 && tokens[2].Substring(0, 2) == "0x") - { - tokens[2] = tokens[2].Substring(2, tokens[2].Length - 2); - packetID = UInt32.Parse(tokens[2], System.Globalization.NumberStyles.HexNumber); - } else { - packetID = UInt32.Parse(tokens[2]); - } - - - if (tokens[1] == "Fixed") - { - - // Truncate the id to a short - packetID &= 0xFFFF; - LowMaps[packetID] = new MapPacket(); - LowMaps[packetID].ID = (ushort)packetID; - LowMaps[packetID].Frequency = PacketFrequency.Low; - LowMaps[packetID].Name = tokens[0]; - LowMaps[packetID].Trusted = (tokens[3] == "Trusted"); - LowMaps[packetID].Encoded = (tokens[4] == "Zerocoded"); - LowMaps[packetID].Blocks = new List(); - - currentPacket = LowMaps[packetID]; - } - else if (tokens[1] == "Low") - { - LowMaps[packetID] = new MapPacket(); - LowMaps[packetID].ID = (ushort)packetID; - LowMaps[packetID].Frequency = PacketFrequency.Low; - LowMaps[packetID].Name = tokens[0]; - LowMaps[packetID].Trusted = (tokens[2] == "Trusted"); - LowMaps[packetID].Encoded = (tokens[4] == "Zerocoded"); - LowMaps[packetID].Blocks = new List(); - - currentPacket = LowMaps[packetID]; - - } - else if (tokens[1] == "Medium") - { - MediumMaps[packetID] = new MapPacket(); - MediumMaps[packetID].ID = (ushort)packetID; - MediumMaps[packetID].Frequency = PacketFrequency.Medium; - MediumMaps[packetID].Name = tokens[0]; - MediumMaps[packetID].Trusted = (tokens[2] == "Trusted"); - MediumMaps[packetID].Encoded = (tokens[4] == "Zerocoded"); - MediumMaps[packetID].Blocks = new List(); - - currentPacket = MediumMaps[packetID]; - - } - else if (tokens[1] == "High") - { - HighMaps[packetID] = new MapPacket(); - HighMaps[packetID].ID = (ushort)packetID; - HighMaps[packetID].Frequency = PacketFrequency.High; - HighMaps[packetID].Name = tokens[0]; - HighMaps[packetID].Trusted = (tokens[2] == "Trusted"); - HighMaps[packetID].Encoded = (tokens[4] == "Zerocoded"); - HighMaps[packetID].Blocks = new List(); - - currentPacket = HighMaps[packetID]; - - } - else - { - //Client.Log("Unknown packet frequency", Helpers.LogLevel.Error); - throw new Exception("Unknown packet frequency"); - } - } - - #endregion - } - } - else - { - if (trimmedline.Length > 0 && trimmedline.Substring(0, 1) == "{") - { - // A field - #region ParseField - - MapField field = new MapField(); - - // Splice the string in to tokens - string[] tokens = trimmedline.Split(new char[] {' ', '\t'}); - - field.Name = tokens[1]; - field.KeywordPosition = KeywordPosition(field.Name); - field.Type = (FieldType)Enum.Parse(typeof(FieldType), tokens[2], true); - - if (tokens[3] != "}") - { - field.Count = Int32.Parse(tokens[3]); - } - else - { - field.Count = 1; - } - - // Save this field to the current block - currentBlock.Fields.Add(field); - - #endregion - } - else if (trimmedline == "}") - { - // currentBlock.Fields.Sort(); - inBlock = false; - } - else if (trimmedline.Length != 0 && trimmedline.Substring(0, 2) != "//") - { - // The block header - #region ParseBlockHeader - - currentBlock = new MapBlock(); - - // Splice the string in to tokens - string[] tokens = trimmedline.Split(new char[] {' ', '\t'}); - - currentBlock.Name = tokens[0]; - currentBlock.KeywordPosition = KeywordPosition(currentBlock.Name); - currentBlock.Fields = new List(); - currentPacket.Blocks.Add(currentBlock); - - if (tokens[1] == "Single") - { - currentBlock.Count = 1; - } - else if (tokens[1] == "Multiple") - { - currentBlock.Count = Int32.Parse(tokens[2]); - } - else if (tokens[1] == "Variable") - { - currentBlock.Count = -1; - } - else - { - //Client.Log("Unknown block frequency", Helpers.LogLevel.Error); - throw new Exception("Unknown block frequency"); - } - - #endregion - } - } - } - - #endregion - } - - r.Close(); - map.Close(); - } - catch (Exception e) - { - throw e; - } - } - - private int KeywordPosition(string keyword) - { - if (KeywordPositions.ContainsKey(keyword)) - { - return KeywordPositions[keyword]; - } - - int hash = 0; - for (int i = 1; i < keyword.Length; i++) - { - hash = (hash + (int)(keyword[i])) * 2; - } - hash *= 2; - hash &= 0x1FFF; - - int startHash = hash; - - while (KeywordPositions.ContainsValue(hash)) - { - hash++; - hash &= 0x1FFF; - if (hash == startHash) - { - //Give up looking, went through all values and they were all taken. - throw new Exception("All hash values are taken. Failed to add keyword: " + keyword); - } - } - - KeywordPositions[keyword] = hash; - return hash; - } - } -} diff --git a/Programs/mapgenerator/mapgenerator.cs b/Programs/mapgenerator/mapgenerator.cs deleted file mode 100644 index 185e2feb..00000000 --- a/Programs/mapgenerator/mapgenerator.cs +++ /dev/null @@ -1,1129 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; - -namespace mapgenerator -{ - class mapgenerator - { - static void WriteFieldMember(TextWriter writer, MapField field) - { - string type = String.Empty; - - switch (field.Type) - { - case FieldType.BOOL: - type = "bool"; - break; - case FieldType.F32: - type = "float"; - break; - case FieldType.F64: - type = "double"; - break; - case FieldType.IPPORT: - case FieldType.U16: - type = "ushort"; - break; - case FieldType.IPADDR: - case FieldType.U32: - type = "uint"; - break; - case FieldType.LLQuaternion: - type = "Quaternion"; - break; - case FieldType.LLUUID: - type = "UUID"; - break; - case FieldType.LLVector3: - type = "Vector3"; - break; - case FieldType.LLVector3d: - type = "Vector3d"; - break; - case FieldType.LLVector4: - type = "Vector4"; - break; - case FieldType.S16: - type = "short"; - break; - case FieldType.S32: - type = "int"; - break; - case FieldType.S8: - type = "sbyte"; - break; - case FieldType.U64: - type = "ulong"; - break; - case FieldType.U8: - type = "byte"; - break; - case FieldType.Fixed: - type = "byte[]"; - break; - } - if (field.Type != FieldType.Variable) - { - //writer.WriteLine(" /// " + field.Name + " field"); - writer.WriteLine(" public " + type + " " + field.Name + ";"); - } - else - { - writer.WriteLine(" public byte[] " + field.Name + ";"); - - //writer.WriteLine(" private byte[] _" + field.Name.ToLower() + ";"); - ////writer.WriteLine(" /// " + field.Name + " field"); - //writer.WriteLine(" public byte[] " + field.Name + Environment.NewLine + " {"); - //writer.WriteLine(" get { return _" + field.Name.ToLower() + "; }"); - //writer.WriteLine(" set" + Environment.NewLine + " {"); - //writer.WriteLine(" if (value == null) { _" + - // field.Name.ToLower() + " = null; return; }"); - //writer.WriteLine(" if (value.Length > " + - // ((field.Count == 1) ? "255" : "1100") + ") { throw new OverflowException(" + - // "\"Value exceeds " + ((field.Count == 1) ? "255" : "1100") + " characters\"); }"); - //writer.WriteLine(" else { _" + field.Name.ToLower() + - // " = new byte[value.Length]; Buffer.BlockCopy(value, 0, _" + - // field.Name.ToLower() + ", 0, value.Length); }"); - //writer.WriteLine(" }" + Environment.NewLine + " }"); - } - } - - static void WriteFieldFromBytes(TextWriter writer, MapField field) - { - switch (field.Type) - { - case FieldType.BOOL: - writer.WriteLine(" " + - field.Name + " = (bytes[i++] != 0) ? (bool)true : (bool)false;"); - break; - case FieldType.F32: - writer.WriteLine(" " + - field.Name + " = Utils.BytesToFloat(bytes, i); i += 4;"); - break; - case FieldType.F64: - writer.WriteLine(" " + - field.Name + " = Utils.BytesToDouble(bytes, i); i += 8;"); - break; - case FieldType.Fixed: - writer.WriteLine(" " + field.Name + " = new byte[" + field.Count + "];"); - writer.WriteLine(" Buffer.BlockCopy(bytes, i, " + field.Name + - ", 0, " + field.Count + "); i += " + field.Count + ";"); - break; - case FieldType.IPADDR: - case FieldType.U32: - writer.WriteLine(" " + field.Name + - " = (uint)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));"); - break; - case FieldType.IPPORT: - // IPPORT is big endian while U16/S16 are little endian. Go figure - writer.WriteLine(" " + field.Name + - " = (ushort)((bytes[i++] << 8) + bytes[i++]);"); - break; - case FieldType.U16: - writer.WriteLine(" " + field.Name + - " = (ushort)(bytes[i++] + (bytes[i++] << 8));"); - break; - case FieldType.LLQuaternion: - writer.WriteLine(" " + field.Name + ".FromBytes(bytes, i, true); i += 12;"); - break; - case FieldType.LLUUID: - writer.WriteLine(" " + field.Name + ".FromBytes(bytes, i); i += 16;"); - break; - case FieldType.LLVector3: - writer.WriteLine(" " + field.Name + ".FromBytes(bytes, i); i += 12;"); - break; - case FieldType.LLVector3d: - writer.WriteLine(" " + field.Name + ".FromBytes(bytes, i); i += 24;"); - break; - case FieldType.LLVector4: - writer.WriteLine(" " + field.Name + ".FromBytes(bytes, i); i += 16;"); - break; - case FieldType.S16: - writer.WriteLine(" " + field.Name + - " = (short)(bytes[i++] + (bytes[i++] << 8));"); - break; - case FieldType.S32: - writer.WriteLine(" " + field.Name + - " = (int)(bytes[i++] + (bytes[i++] << 8) + (bytes[i++] << 16) + (bytes[i++] << 24));"); - break; - case FieldType.S8: - writer.WriteLine(" " + field.Name + - " = (sbyte)bytes[i++];"); - break; - case FieldType.U64: - writer.WriteLine(" " + field.Name + - " = (ulong)((ulong)bytes[i++] + ((ulong)bytes[i++] << 8) + " + - "((ulong)bytes[i++] << 16) + ((ulong)bytes[i++] << 24) + " + - "((ulong)bytes[i++] << 32) + ((ulong)bytes[i++] << 40) + " + - "((ulong)bytes[i++] << 48) + ((ulong)bytes[i++] << 56));"); - break; - case FieldType.U8: - writer.WriteLine(" " + field.Name + - " = (byte)bytes[i++];"); - break; - case FieldType.Variable: - if (field.Count == 1) - { - writer.WriteLine(" length = bytes[i++];"); - } - else - { - writer.WriteLine(" length = (bytes[i++] + (bytes[i++] << 8));"); - } - writer.WriteLine(" " + field.Name + " = new byte[length];"); - writer.WriteLine(" Buffer.BlockCopy(bytes, i, " + field.Name + ", 0, length); i += length;"); - break; - default: - writer.WriteLine("!!! ERROR: Unhandled FieldType: " + field.Type.ToString() + " !!!"); - break; - } - } - - static void WriteFieldToBytes(TextWriter writer, MapField field) - { - writer.Write(" "); - - switch (field.Type) - { - case FieldType.BOOL: - writer.WriteLine("bytes[i++] = (byte)((" + field.Name + ") ? 1 : 0);"); - break; - case FieldType.F32: - writer.WriteLine("Utils.FloatToBytes(" + field.Name + ", bytes, i); i += 4;"); - break; - case FieldType.F64: - writer.WriteLine("Utils.DoubleToBytes(" + field.Name + ", bytes, i); i += 8;"); - break; - case FieldType.Fixed: - writer.WriteLine("Buffer.BlockCopy(" + field.Name + ", 0, bytes, i, " + field.Count + ");" + - "i += " + field.Count + ";"); - break; - case FieldType.IPPORT: - // IPPORT is big endian while U16/S16 is little endian. Go figure - writer.WriteLine("bytes[i++] = (byte)((" + field.Name + " >> 8) % 256);"); - writer.WriteLine(" bytes[i++] = (byte)(" + field.Name + " % 256);"); - break; - case FieldType.U16: - case FieldType.S16: - writer.WriteLine("bytes[i++] = (byte)(" + field.Name + " % 256);"); - writer.WriteLine(" bytes[i++] = (byte)((" + field.Name + " >> 8) % 256);"); - break; - case FieldType.LLQuaternion: - case FieldType.LLVector3: - writer.WriteLine(field.Name + ".ToBytes(bytes, i); i += 12;"); - break; - case FieldType.LLUUID: - case FieldType.LLVector4: - writer.WriteLine(field.Name + ".ToBytes(bytes, i); i += 16;"); - break; - case FieldType.LLVector3d: - writer.WriteLine(field.Name + ".ToBytes(bytes, i); i += 24;"); - break; - case FieldType.U8: - writer.WriteLine("bytes[i++] = " + field.Name + ";"); - break; - case FieldType.S8: - writer.WriteLine("bytes[i++] = (byte)" + field.Name + ";"); - break; - case FieldType.IPADDR: - case FieldType.U32: - writer.WriteLine("Utils.UIntToBytes(" + field.Name + ", bytes, i); i += 4;"); - break; - case FieldType.S32: - writer.WriteLine("Utils.IntToBytes(" + field.Name + ", bytes, i); i += 4;"); - break; - case FieldType.U64: - writer.WriteLine("Utils.UInt64ToBytes(" + field.Name + ", bytes, i); i += 8;"); - break; - case FieldType.Variable: - //writer.WriteLine("if(" + field.Name + " == null) { Console.WriteLine(\"Warning: " + field.Name + " is null, in \" + this.GetType()); }"); - //writer.Write(" "); - if (field.Count == 1) - { - writer.WriteLine("bytes[i++] = (byte)" + field.Name + ".Length;"); - } - else - { - writer.WriteLine("bytes[i++] = (byte)(" + field.Name + ".Length % 256);"); - writer.WriteLine(" bytes[i++] = (byte)((" + - field.Name + ".Length >> 8) % 256);"); - } - writer.WriteLine(" Buffer.BlockCopy(" + field.Name + ", 0, bytes, i, " + - field.Name + ".Length); " + "i += " + field.Name + ".Length;"); - break; - default: - writer.WriteLine("!!! ERROR: Unhandled FieldType: " + field.Type.ToString() + " !!!"); - break; - } - } - - static int GetFieldLength(TextWriter writer, MapField field) - { - switch (field.Type) - { - case FieldType.BOOL: - case FieldType.U8: - case FieldType.S8: - return 1; - case FieldType.U16: - case FieldType.S16: - case FieldType.IPPORT: - return 2; - case FieldType.U32: - case FieldType.S32: - case FieldType.F32: - case FieldType.IPADDR: - return 4; - case FieldType.U64: - case FieldType.F64: - return 8; - case FieldType.LLVector3: - case FieldType.LLQuaternion: - return 12; - case FieldType.LLUUID: - case FieldType.LLVector4: - return 16; - case FieldType.LLVector3d: - return 24; - case FieldType.Fixed: - return field.Count; - case FieldType.Variable: - return 0; - default: - writer.WriteLine("!!! ERROR: Unhandled FieldType " + field.Type.ToString() + " !!!"); - return 0; - } - } - - static void WriteBlockClass(TextWriter writer, MapBlock block, MapPacket packet) - { - int variableFieldCountBytes = 0; - - //writer.WriteLine(" /// " + block.Name + " block"); - writer.WriteLine(" /// "); - writer.WriteLine(" public sealed class " + block.Name + "Block : PacketBlock" + Environment.NewLine + " {"); - - foreach (MapField field in block.Fields) - { - WriteFieldMember(writer, field); - if (field.Type == FieldType.Variable) { variableFieldCountBytes += field.Count; } - } - - // Length property - writer.WriteLine(""); - //writer.WriteLine(" /// Length of this block serialized in bytes"); - writer.WriteLine(" public override int Length" + Environment.NewLine + - " {" + Environment.NewLine + - " get" + Environment.NewLine + - " {"); - int length = variableFieldCountBytes; - - // Figure out the length of this block - foreach (MapField field in block.Fields) - { - length += GetFieldLength(writer, field); - } - - if (variableFieldCountBytes == 0) - { - writer.WriteLine(" return " + length + ";"); - } - else - { - writer.WriteLine(" int length = " + length + ";"); - - foreach (MapField field in block.Fields) - { - if (field.Type == FieldType.Variable) - { - writer.WriteLine(" if (" + field.Name + - " != null) { length += " + field.Name + ".Length; }"); - } - } - - writer.WriteLine(" return length;"); - } - - writer.WriteLine(" }" + Environment.NewLine + " }" + Environment.NewLine); - - // Default constructor - //writer.WriteLine(" /// Default constructor"); - writer.WriteLine(" public " + block.Name + "Block() { }"); - - // Constructor for building the class from bytes - //writer.WriteLine(" /// Constructor for building the block from a byte array"); - writer.WriteLine(" public " + block.Name + "Block(byte[] bytes, ref int i)" + Environment.NewLine + - " {" + Environment.NewLine + - " FromBytes(bytes, ref i);" + Environment.NewLine + - " }" + Environment.NewLine); - - // Initiates instance variables from a byte message - writer.WriteLine(" public override void FromBytes(byte[] bytes, ref int i)" + Environment.NewLine + - " {"); - - // Declare a length variable if we need it for variable fields in this constructor - if (variableFieldCountBytes > 0) { writer.WriteLine(" int length;"); } - - // Start of the try catch block - writer.WriteLine(" try" + Environment.NewLine + " {"); - - foreach (MapField field in block.Fields) - { - WriteFieldFromBytes(writer, field); - } - - writer.WriteLine(" }" + Environment.NewLine + - " catch (Exception)" + Environment.NewLine + - " {" + Environment.NewLine + - " throw new MalformedDataException();" + Environment.NewLine + - " }" + Environment.NewLine + " }" + Environment.NewLine); - - // ToBytes() function - //writer.WriteLine(" /// Serialize this block to a byte array"); - writer.WriteLine(" public override void ToBytes(byte[] bytes, ref int i)" + Environment.NewLine + - " {"); - - foreach (MapField field in block.Fields) - { - WriteFieldToBytes(writer, field); - } - - writer.WriteLine(" }" + Environment.NewLine); - writer.WriteLine(" }" + Environment.NewLine); - } - - static void WritePacketClass(TextWriter writer, MapPacket packet) - { - bool hasVariableBlocks = false; - string sanitizedName; - - //writer.WriteLine(" /// " + packet.Name + " packet"); - writer.WriteLine(" /// "); - writer.WriteLine(" public sealed class " + packet.Name + "Packet : Packet" + Environment.NewLine + " {"); - - // Write out each block class - foreach (MapBlock block in packet.Blocks) - { - WriteBlockClass(writer, block, packet); - } - - // Length member - writer.WriteLine(" public override int Length" + Environment.NewLine + - " {" + Environment.NewLine + " get" + Environment.NewLine + - " {"); - - int length = 0; - if (packet.Frequency == PacketFrequency.Low) { length = 10; } - else if (packet.Frequency == PacketFrequency.Medium) { length = 8; } - else { length = 7; } - - foreach (MapBlock block in packet.Blocks) - { - if (block.Count == -1) - { - hasVariableBlocks = true; - ++length; - } - } - - writer.WriteLine(" int length = " + length + ";"); - - foreach (MapBlock block in packet.Blocks) - { - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == -1) - { - // Variable count block - writer.WriteLine(" for (int j = 0; j < " + sanitizedName + ".Length; j++)"); - writer.WriteLine(" length += " + sanitizedName + "[j].Length;"); - } - else if (block.Count == 1) - { - writer.WriteLine(" length += " + sanitizedName + ".Length;"); - } - else - { - // Multiple count block - writer.WriteLine(" for (int j = 0; j < " + block.Count + "; j++)"); - writer.WriteLine(" length += " + sanitizedName + "[j].Length;"); - } - } - writer.WriteLine(" return length;"); - writer.WriteLine(" }" + Environment.NewLine + " }"); - - // Block members - foreach (MapBlock block in packet.Blocks) - { - // TODO: More thorough name blacklisting - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - //writer.WriteLine(" /// " + block.Name + " block"); - writer.WriteLine(" public " + block.Name + "Block" + - ((block.Count != 1) ? "[]" : "") + " " + sanitizedName + ";"); - } - - writer.WriteLine(""); - - // Default constructor - //writer.WriteLine(" /// Default constructor"); - writer.WriteLine(" public " + packet.Name + "Packet()" + Environment.NewLine + " {"); - writer.WriteLine(" HasVariableBlocks = " + hasVariableBlocks.ToString().ToLowerInvariant() + ";"); - writer.WriteLine(" Type = PacketType." + packet.Name + ";"); - writer.WriteLine(" Header = new Header();"); - writer.WriteLine(" Header.Frequency = PacketFrequency." + packet.Frequency + ";"); - writer.WriteLine(" Header.ID = " + packet.ID + ";"); - writer.WriteLine(" Header.Reliable = true;"); // Turn the reliable flag on by default - if (packet.Encoded) { writer.WriteLine(" Header.Zerocoded = true;"); } - foreach (MapBlock block in packet.Blocks) - { - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == 1) - { - // Single count block - writer.WriteLine(" " + sanitizedName + " = new " + block.Name + "Block();"); - } - else if (block.Count == -1) - { - // Variable count block - writer.WriteLine(" " + sanitizedName + " = null;"); - } - else - { - // Multiple count block - writer.WriteLine(" " + sanitizedName + " = new " + block.Name + "Block[" + block.Count + "];"); - } - } - writer.WriteLine(" }" + Environment.NewLine); - - // Constructor that takes a byte array and beginning position only (no prebuilt header) - bool seenVariable = false; - //writer.WriteLine(" /// Constructor that takes a byte array and beginning position (no prebuilt header)"); - writer.WriteLine(" public " + packet.Name + "Packet(byte[] bytes, ref int i) : this()" + Environment.NewLine + - " {" + Environment.NewLine + - " int packetEnd = bytes.Length - 1;" + Environment.NewLine + - " FromBytes(bytes, ref i, ref packetEnd, null);" + Environment.NewLine + - " }" + Environment.NewLine); - - writer.WriteLine(" override public void FromBytes(byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer)" + Environment.NewLine + " {"); - writer.WriteLine(" Header.FromBytes(bytes, ref i, ref packetEnd);"); - writer.WriteLine(" if (Header.Zerocoded && zeroBuffer != null)"); - writer.WriteLine(" {"); - writer.WriteLine(" packetEnd = Helpers.ZeroDecode(bytes, packetEnd + 1, zeroBuffer) - 1;"); - writer.WriteLine(" bytes = zeroBuffer;"); - writer.WriteLine(" }"); - - foreach (MapBlock block in packet.Blocks) - { - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == 1) - { - // Single count block - writer.WriteLine(" " + sanitizedName + ".FromBytes(bytes, ref i);"); - } - else if (block.Count == -1) - { - // Variable count block - if (!seenVariable) - { - writer.WriteLine(" int count = (int)bytes[i++];"); - seenVariable = true; - } - else - { - writer.WriteLine(" count = (int)bytes[i++];"); - } - writer.WriteLine(" if(" + sanitizedName + " == null || " + sanitizedName + ".Length != " + block.Count + ") {"); - writer.WriteLine(" " + sanitizedName + " = new " + block.Name + "Block[count];"); - writer.WriteLine(" for(int j = 0; j < count; j++)"); - writer.WriteLine(" { " + sanitizedName + "[j] = new " + block.Name + "Block(); }"); - writer.WriteLine(" }"); - writer.WriteLine(" for (int j = 0; j < count; j++)"); - writer.WriteLine(" { " + sanitizedName + "[j].FromBytes(bytes, ref i); }"); - } - else - { - // Multiple count block - writer.WriteLine(" if(" + sanitizedName + " == null || " + sanitizedName + ".Length != " + block.Count + ") {"); - writer.WriteLine(" " + sanitizedName + " = new " + block.Name + "Block[" + block.Count + "];"); - writer.WriteLine(" for(int j = 0; j < " + block.Count + "; j++)"); - writer.WriteLine(" { " + sanitizedName + "[j] = new " + block.Name + "Block(); }"); - writer.WriteLine(" }"); - writer.WriteLine(" for (int j = 0; j < " + block.Count + "; j++)"); - writer.WriteLine(" { " + sanitizedName + "[j].FromBytes(bytes, ref i); }"); - } - } - writer.WriteLine(" }" + Environment.NewLine); - - seenVariable = false; - - // Constructor that takes a byte array and a prebuilt header - //writer.WriteLine(" /// Constructor that takes a byte array and a prebuilt header"); - writer.WriteLine(" public " + packet.Name + "Packet(Header head, byte[] bytes, ref int i): this()" + Environment.NewLine + - " {" + Environment.NewLine + - " int packetEnd = bytes.Length - 1;" + Environment.NewLine + - " FromBytes(head, bytes, ref i, ref packetEnd);" + Environment.NewLine + - " }" + Environment.NewLine); - - writer.WriteLine(" override public void FromBytes(Header header, byte[] bytes, ref int i, ref int packetEnd)" + Environment.NewLine + - " {"); - writer.WriteLine(" Header = header;"); - foreach (MapBlock block in packet.Blocks) - { - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == 1) - { - // Single count block - writer.WriteLine(" " + sanitizedName + ".FromBytes(bytes, ref i);"); - } - else if (block.Count == -1) - { - // Variable count block - if (!seenVariable) - { - writer.WriteLine(" int count = (int)bytes[i++];"); - seenVariable = true; - } - else - { - writer.WriteLine(" count = (int)bytes[i++];"); - } - writer.WriteLine(" if(" + sanitizedName + " == null || " + sanitizedName + ".Length != count) {"); - writer.WriteLine(" " + sanitizedName + " = new " + block.Name + "Block[count];"); - writer.WriteLine(" for(int j = 0; j < count; j++)"); - writer.WriteLine(" { " + sanitizedName + "[j] = new " + block.Name + "Block(); }"); - writer.WriteLine(" }"); - writer.WriteLine(" for (int j = 0; j < count; j++)"); - writer.WriteLine(" { " + sanitizedName + "[j].FromBytes(bytes, ref i); }"); - } - else - { - // Multiple count block - writer.WriteLine(" if(" + sanitizedName + " == null || " + sanitizedName + ".Length != " + block.Count + ") {"); - writer.WriteLine(" " + sanitizedName + " = new " + block.Name + "Block[" + block.Count + "];"); - writer.WriteLine(" for(int j = 0; j < " + block.Count + "; j++)"); - writer.WriteLine(" { " + sanitizedName + "[j] = new " + block.Name + "Block(); }"); - writer.WriteLine(" }"); - writer.WriteLine(" for (int j = 0; j < " + block.Count + "; j++)"); - writer.WriteLine(" { " + sanitizedName + "[j].FromBytes(bytes, ref i); }"); - } - } - writer.WriteLine(" }" + Environment.NewLine); - - #region ToBytes() Function - - //writer.WriteLine(" /// Serialize this packet to a byte arrayA byte array containing the serialized packet"); - writer.WriteLine(" public override byte[] ToBytes()" + Environment.NewLine + " {"); - - writer.Write(" int length = "); - if (packet.Frequency == PacketFrequency.Low) { writer.WriteLine("10;"); } - else if (packet.Frequency == PacketFrequency.Medium) { writer.WriteLine("8;"); } - else { writer.WriteLine("7;"); } - - foreach (MapBlock block in packet.Blocks) - { - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == 1) - { - // Single count block - writer.WriteLine(" length += " + sanitizedName + ".Length;"); - } - } - - foreach (MapBlock block in packet.Blocks) - { - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == -1) - { - writer.WriteLine(" length++;"); - writer.WriteLine(" for (int j = 0; j < " + sanitizedName + - ".Length; j++) { length += " + sanitizedName + "[j].Length; }"); - } - else if (block.Count > 1) - { - writer.WriteLine(" for (int j = 0; j < " + block.Count + - "; j++) { length += " + sanitizedName + "[j].Length; }"); - } - } - - writer.WriteLine(" if (Header.AckList != null && Header.AckList.Length > 0) { length += Header.AckList.Length * 4 + 1; }"); - writer.WriteLine(" byte[] bytes = new byte[length];"); - writer.WriteLine(" int i = 0;"); - writer.WriteLine(" Header.ToBytes(bytes, ref i);"); - foreach (MapBlock block in packet.Blocks) - { - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == -1) - { - // Variable count block - writer.WriteLine(" bytes[i++] = (byte)" + sanitizedName + ".Length;"); - writer.WriteLine(" for (int j = 0; j < " + sanitizedName + - ".Length; j++) { " + sanitizedName + "[j].ToBytes(bytes, ref i); }"); - } - else if (block.Count == 1) - { - writer.WriteLine(" " + sanitizedName + ".ToBytes(bytes, ref i);"); - } - else - { - // Multiple count block - writer.WriteLine(" for (int j = 0; j < " + block.Count + - "; j++) { " + sanitizedName + "[j].ToBytes(bytes, ref i); }"); - } - } - - writer.WriteLine(" if (Header.AckList != null && Header.AckList.Length > 0) { Header.AcksToBytes(bytes, ref i); }"); - writer.WriteLine(" return bytes;" + Environment.NewLine + " }" + Environment.NewLine); - - #endregion ToBytes() Function - - WriteToBytesMultiple(writer, packet); - - writer.WriteLine(" }" + Environment.NewLine); - } - - static void WriteToBytesMultiple(TextWriter writer, MapPacket packet) - { - writer.WriteLine( - " public override byte[][] ToBytesMultiple()" + Environment.NewLine + - " {"); - - // Check if there are any variable blocks - bool hasVariable = false; - bool cannotSplit = false; - foreach (MapBlock block in packet.Blocks) - { - if (block.Count == -1) - { - hasVariable = true; - } - else if (hasVariable) - { - // A fixed or single block showed up after a variable count block. - // Our automatic splitting algorithm won't work for this packet - cannotSplit = true; - break; - } - } - - if (hasVariable && !cannotSplit) - { - writer.WriteLine( - " System.Collections.Generic.List packets = new System.Collections.Generic.List();"); - writer.WriteLine( - " int i = 0;"); - writer.Write( - " int fixedLength = "); - if (packet.Frequency == PacketFrequency.Low) { writer.WriteLine("10;"); } - else if (packet.Frequency == PacketFrequency.Medium) { writer.WriteLine("8;"); } - else { writer.WriteLine("7;"); } - writer.WriteLine(); - - // ACK serialization - writer.WriteLine(" byte[] ackBytes = null;"); - writer.WriteLine(" int acksLength = 0;"); - writer.WriteLine(" if (Header.AckList != null && Header.AckList.Length > 0) {"); - writer.WriteLine(" Header.AppendedAcks = true;"); - writer.WriteLine(" ackBytes = new byte[Header.AckList.Length * 4 + 1];"); - writer.WriteLine(" Header.AcksToBytes(ackBytes, ref acksLength);"); - writer.WriteLine(" }"); - writer.WriteLine(); - - // Count fixed blocks - foreach (MapBlock block in packet.Blocks) - { - string sanitizedName; - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == 1) - { - // Single count block - writer.WriteLine(" fixedLength += " + sanitizedName + ".Length;"); - } - else if (block.Count > 0) - { - // Fixed count block - writer.WriteLine(" for (int j = 0; j < " + block.Count + "; j++) { fixedLength += " + sanitizedName + "[j].Length; }"); - } - } - - // Serialize fixed blocks - writer.WriteLine( - " byte[] fixedBytes = new byte[fixedLength];"); - writer.WriteLine( - " Header.ToBytes(fixedBytes, ref i);"); - foreach (MapBlock block in packet.Blocks) - { - string sanitizedName; - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == 1) - { - // Single count block - writer.WriteLine(" " + sanitizedName + ".ToBytes(fixedBytes, ref i);"); - } - else if (block.Count > 0) - { - // Fixed count block - writer.WriteLine(" for (int j = 0; j < " + block.Count + "; j++) { " + sanitizedName + "[j].ToBytes(fixedBytes, ref i); }"); - } - } - - int variableCountBlock = 0; - foreach (MapBlock block in packet.Blocks) - { - string sanitizedName; - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == -1) - { - // Variable count block - ++variableCountBlock; - } - } - writer.WriteLine(" fixedLength += " + variableCountBlock + ";"); - writer.WriteLine(); - - foreach (MapBlock block in packet.Blocks) - { - string sanitizedName; - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == -1) - { - // Variable count block - writer.WriteLine(" int " + sanitizedName + "Start = 0;"); - } - } - - writer.WriteLine(" do"); - writer.WriteLine(" {"); - - // Count how many variable blocks can go in this packet - writer.WriteLine(" int variableLength = 0;"); - - foreach (MapBlock block in packet.Blocks) - { - string sanitizedName; - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == -1) - { - // Variable count block - writer.WriteLine(" int " + sanitizedName + "Count = 0;"); - } - } - writer.WriteLine(); - - foreach (MapBlock block in packet.Blocks) - { - string sanitizedName; - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == -1) - { - // Variable count block - writer.WriteLine(" i = " + sanitizedName + "Start;"); - writer.WriteLine(" while (fixedLength + variableLength + acksLength < Packet.MTU && i < " + sanitizedName + ".Length) {"); - writer.WriteLine(" int blockLength = " + sanitizedName + "[i].Length;"); - writer.WriteLine(" if (fixedLength + variableLength + blockLength + acksLength <= MTU || i == " + sanitizedName + "Start) {"); - writer.WriteLine(" variableLength += blockLength;"); - writer.WriteLine(" ++" + sanitizedName + "Count;"); - writer.WriteLine(" }"); - writer.WriteLine(" else { break; }"); - writer.WriteLine(" ++i;"); - writer.WriteLine(" }"); - writer.WriteLine(); - } - } - - // Create the packet - writer.WriteLine(" byte[] packet = new byte[fixedLength + variableLength + acksLength];"); - writer.WriteLine(" int length = fixedBytes.Length;"); - writer.WriteLine(" Buffer.BlockCopy(fixedBytes, 0, packet, 0, length);"); - // Remove the appended ACKs flag from subsequent packets - writer.WriteLine(" if (packets.Count > 0) { packet[0] = (byte)(packet[0] & ~0x10); }"); - writer.WriteLine(); - - foreach (MapBlock block in packet.Blocks) - { - string sanitizedName; - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == -1) - { - writer.WriteLine(" packet[length++] = (byte)" + sanitizedName + "Count;"); - writer.WriteLine(" for (i = " + sanitizedName + "Start; i < " + sanitizedName + "Start + " - + sanitizedName + "Count; i++) { " + sanitizedName + "[i].ToBytes(packet, ref length); }"); - writer.WriteLine(" " + sanitizedName + "Start += " + sanitizedName + "Count;"); - writer.WriteLine(); - } - } - - // ACK appending - writer.WriteLine(" if (acksLength > 0) {"); - writer.WriteLine(" Buffer.BlockCopy(ackBytes, 0, packet, length, acksLength);"); - writer.WriteLine(" acksLength = 0;"); - writer.WriteLine(" }"); - writer.WriteLine(); - - writer.WriteLine(" packets.Add(packet);"); - - writer.WriteLine(" } while ("); - bool first = true; - foreach (MapBlock block in packet.Blocks) - { - string sanitizedName; - if (block.Name == "Header") { sanitizedName = "_" + block.Name; } - else { sanitizedName = block.Name; } - - if (block.Count == -1) - { - if (first) first = false; - else writer.WriteLine(" ||"); - - // Variable count block - writer.Write(" " + sanitizedName + "Start < " + sanitizedName + ".Length"); - } - } - writer.WriteLine(");"); - writer.WriteLine(); - writer.WriteLine(" return packets.ToArray();"); - writer.WriteLine(" }"); - } - else - { - writer.WriteLine(" return new byte[][] { ToBytes() };"); - writer.WriteLine(" }"); - } - } - - static int Main(string[] args) - { - ProtocolManager protocol; - List unused = new List(); - TextWriter writer; - - try - { - if (args.Length != 4) - { - Console.WriteLine("Usage: [message_template.msg] [template.cs] [unusedpackets.txt] [_Packets_.cs]"); - return -1; - } - - writer = new StreamWriter(args[3]); - protocol = new ProtocolManager(args[0]); - - // Build a list of unused packets - using (StreamReader unusedReader = new StreamReader(args[2])) - { - while (unusedReader.Peek() >= 0) - { - unused.Add(unusedReader.ReadLine().Trim()); - } - } - - // Read in the template.cs file and write it to our output - TextReader reader = new StreamReader(args[1]); - writer.WriteLine(reader.ReadToEnd()); - reader.Close(); - } - catch (Exception e) - { - Console.WriteLine(e.ToString()); - return -2; - } - - - // Prune all of the unused packets out of the protocol - int i = 0; - foreach (MapPacket packet in protocol.LowMaps) - { - if (packet != null && unused.Contains(packet.Name)) - protocol.LowMaps[i] = null; - i++; - } - i = 0; - foreach (MapPacket packet in protocol.MediumMaps) - { - if (packet != null && unused.Contains(packet.Name)) - protocol.MediumMaps[i] = null; - i++; - } - i = 0; - foreach (MapPacket packet in protocol.HighMaps) - { - if (packet != null && unused.Contains(packet.Name)) - protocol.HighMaps[i] = null; - i++; - } - - - // Write the PacketType enum - writer.WriteLine(" public enum PacketType" + Environment.NewLine + " {" + Environment.NewLine + - " /// A generic value, not an actual packet type" + Environment.NewLine + - " Default,"); - foreach (MapPacket packet in protocol.LowMaps) - if (packet != null) - writer.WriteLine(" " + packet.Name + " = " + (0x10000 | packet.ID) + ","); - foreach (MapPacket packet in protocol.MediumMaps) - if (packet != null) - writer.WriteLine(" " + packet.Name + " = " + (0x20000 | packet.ID) + ","); - foreach (MapPacket packet in protocol.HighMaps) - if (packet != null) - writer.WriteLine(" " + packet.Name + " = " + (0x30000 | packet.ID) + ","); - writer.WriteLine(" }" + Environment.NewLine); - - // Write the base Packet class - writer.WriteLine( - " public abstract partial class Packet" + Environment.NewLine + " {" + Environment.NewLine + - " public const int MTU = 1200;" + Environment.NewLine + - Environment.NewLine + - " public Header Header;" + Environment.NewLine + - " public bool HasVariableBlocks;" + Environment.NewLine + - " public PacketType Type;" + Environment.NewLine + - " public abstract int Length { get; }" + Environment.NewLine + - " public abstract void FromBytes(byte[] bytes, ref int i, ref int packetEnd, byte[] zeroBuffer);" + Environment.NewLine + - " public abstract void FromBytes(Header header, byte[] bytes, ref int i, ref int packetEnd);" + Environment.NewLine + - " public abstract byte[] ToBytes();" + Environment.NewLine + - " public abstract byte[][] ToBytesMultiple();" - ); - writer.WriteLine(); - - // Write the Packet.GetType() function - writer.WriteLine( - " public static PacketType GetType(ushort id, PacketFrequency frequency)" + Environment.NewLine + - " {" + Environment.NewLine + - " switch (frequency)" + Environment.NewLine + - " {" + Environment.NewLine + - " case PacketFrequency.Low:" + Environment.NewLine + - " switch (id)" + Environment.NewLine + - " {"); - foreach (MapPacket packet in protocol.LowMaps) - if (packet != null) - writer.WriteLine(" case " + packet.ID + ": return PacketType." + packet.Name + ";"); - writer.WriteLine(" }" + Environment.NewLine + - " break;" + Environment.NewLine + - " case PacketFrequency.Medium:" + Environment.NewLine + - " switch (id)" + Environment.NewLine + " {"); - foreach (MapPacket packet in protocol.MediumMaps) - if (packet != null) - writer.WriteLine(" case " + packet.ID + ": return PacketType." + packet.Name + ";"); - writer.WriteLine(" }" + Environment.NewLine + - " break;" + Environment.NewLine + - " case PacketFrequency.High:" + Environment.NewLine + - " switch (id)" + Environment.NewLine + " {"); - foreach (MapPacket packet in protocol.HighMaps) - if (packet != null) - writer.WriteLine(" case " + packet.ID + ": return PacketType." + packet.Name + ";"); - writer.WriteLine(" }" + Environment.NewLine + - " break;" + Environment.NewLine + " }" + Environment.NewLine + Environment.NewLine + - " return PacketType.Default;" + Environment.NewLine + " }" + Environment.NewLine); - - // Write the Packet.BuildPacket(PacketType) function - writer.WriteLine(" public static Packet BuildPacket(PacketType type)"); - writer.WriteLine(" {"); - foreach (MapPacket packet in protocol.HighMaps) - if (packet != null) - writer.WriteLine(" if(type == PacketType." + packet.Name + ") return new " + packet.Name + "Packet();"); - foreach (MapPacket packet in protocol.MediumMaps) - if (packet != null) - writer.WriteLine(" if(type == PacketType." + packet.Name + ") return new " + packet.Name + "Packet();"); - foreach (MapPacket packet in protocol.LowMaps) - if (packet != null) - writer.WriteLine(" if(type == PacketType." + packet.Name + ") return new " + packet.Name + "Packet();"); - writer.WriteLine(" return null;" + Environment.NewLine); - writer.WriteLine(" }"); - - // Write the Packet.BuildPacket() function - writer.WriteLine(@" - public static Packet BuildPacket(byte[] packetBuffer, ref int packetEnd, byte[] zeroBuffer) - { - byte[] bytes; - int i = 0; - Header header = Header.BuildHeader(packetBuffer, ref i, ref packetEnd); - if (header.Zerocoded) - { - packetEnd = Helpers.ZeroDecode(packetBuffer, packetEnd + 1, zeroBuffer) - 1; - bytes = zeroBuffer; - } - else - { - bytes = packetBuffer; - } - Array.Clear(bytes, packetEnd + 1, bytes.Length - packetEnd - 1); - - switch (header.Frequency) - { - case PacketFrequency.Low: - switch (header.ID) - {"); - foreach (MapPacket packet in protocol.LowMaps) - if (packet != null) - writer.WriteLine(" case " + packet.ID + ": return new " + packet.Name + "Packet(header, bytes, ref i);"); - writer.WriteLine(@" - } - break; - case PacketFrequency.Medium: - switch (header.ID) - {"); - foreach (MapPacket packet in protocol.MediumMaps) - if (packet != null) - writer.WriteLine(" case " + packet.ID + ": return new " + packet.Name + "Packet(header, bytes, ref i);"); - writer.WriteLine(@" - } - break; - case PacketFrequency.High: - switch (header.ID) - {"); - foreach (MapPacket packet in protocol.HighMaps) - if (packet != null) - writer.WriteLine(" case " + packet.ID + ": return new " + packet.Name + "Packet(header, bytes, ref i);"); - writer.WriteLine(@" - } - break; - } - - throw new MalformedDataException(""Unknown packet ID "" + header.Frequency + "" "" + header.ID); - } - }"); - - // Write the packet classes - foreach (MapPacket packet in protocol.LowMaps) - if (packet != null) { WritePacketClass(writer, packet); } - foreach (MapPacket packet in protocol.MediumMaps) - if (packet != null) { WritePacketClass(writer, packet); } - foreach (MapPacket packet in protocol.HighMaps) - if (packet != null) { WritePacketClass(writer, packet); } - - - // Finish up - writer.WriteLine("}"); - writer.Close(); - return 0; - } - } -} diff --git a/Programs/mapgenerator/mapgenerator.csproj b/Programs/mapgenerator/mapgenerator.csproj deleted file mode 100644 index e395c73f..00000000 --- a/Programs/mapgenerator/mapgenerator.csproj +++ /dev/null @@ -1,88 +0,0 @@ - - - Local - 14.0.25123 - 2.0 - {2867B4B3-0000-0000-0000-000000000000} - Debug - - - - mapgenerator - JScript - Grid - IE50 - false - v4.0 - Exe - - mapgenerator - - - - - - - True - 285212672 - False - - - TRACE;DEBUG - - True - 4096 - False - ..\..\bin\ - False - False - False - 4 - False - 1591,1574,0419 - AnyCPU - - - True - 285212672 - False - - - TRACE - - False - 4096 - True - ..\..\bin\ - False - False - False - 4 - False - 1591,1574,0419 - AnyCPU - - - - System - False - - - - - - - Code - - - Code - - - - - - - - - - diff --git a/Programs/mapgenerator/template.cs b/Programs/mapgenerator/template.cs deleted file mode 100644 index fb7f3649..00000000 --- a/Programs/mapgenerator/template.cs +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright (c) 2006-2016, openmetaverse.co - * All rights reserved. - * - * - Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - Neither the name of the Second Life Reverse Engineering Team nor the names - * of its contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Text; -using OpenMetaverse; - -namespace OpenMetaverse -{ - /// - /// - /// - public enum PacketFrequency : byte - { - /// - Low, - /// - Medium, - /// - High - } -} - -namespace OpenMetaverse.Packets -{ - /// - /// Thrown when a packet could not be successfully deserialized - /// - public class MalformedDataException : ApplicationException - { - /// - /// Default constructor - /// - public MalformedDataException() { } - - /// - /// Constructor that takes an additional error message - /// - /// An error message to attach to this exception - public MalformedDataException(string Message) - : base(Message) - { - this.Source = "Packet decoding"; - } - } - - /// - /// The header of a message template packet. Holds packet flags, sequence - /// number, packet ID, and any ACKs that will be appended at the end of - /// the packet - /// - public struct Header - { - public bool Reliable; - public bool Resent; - public bool Zerocoded; - public bool AppendedAcks; - public uint Sequence; - public ushort ID; - public PacketFrequency Frequency; - public uint[] AckList; - - public void ToBytes(byte[] bytes, ref int i) - { - byte flags = 0; - if (Reliable) flags |= Helpers.MSG_RELIABLE; - if (Resent) flags |= Helpers.MSG_RESENT; - if (Zerocoded) flags |= Helpers.MSG_ZEROCODED; - if (AppendedAcks) flags |= Helpers.MSG_APPENDED_ACKS; - - // Flags - bytes[i++] = flags; - - // Sequence number - Utils.UIntToBytesBig(Sequence, bytes, i); - i += 4; - - // Extra byte - bytes[i++] = 0; - - // Packet ID - switch (Frequency) - { - case PacketFrequency.High: - // 1 byte ID - bytes[i++] = (byte)ID; - break; - case PacketFrequency.Medium: - // 2 byte ID - bytes[i++] = 0xFF; - bytes[i++] = (byte)ID; - break; - case PacketFrequency.Low: - // 4 byte ID - bytes[i++] = 0xFF; - bytes[i++] = 0xFF; - Utils.UInt16ToBytesBig(ID, bytes, i); - i += 2; - break; - } - } - - public void FromBytes(byte[] bytes, ref int pos, ref int packetEnd) - { - this = BuildHeader(bytes, ref pos, ref packetEnd); - } - - /// - /// Convert the AckList to a byte array, used for packet serializing - /// - /// Reference to the target byte array - /// Beginning position to start writing to in the byte - /// array, will be updated with the ending position of the ACK list - public void AcksToBytes(byte[] bytes, ref int i) - { - foreach (uint ack in AckList) - { - Utils.UIntToBytesBig(ack, bytes, i); - i += 4; - } - if (AckList.Length > 0) { bytes[i++] = (byte)AckList.Length; } - } - - /// - /// - /// - /// - /// - /// - /// - public static Header BuildHeader(byte[] bytes, ref int pos, ref int packetEnd) - { - Header header; - byte flags = bytes[pos]; - - header.AppendedAcks = (flags & Helpers.MSG_APPENDED_ACKS) != 0; - header.Reliable = (flags & Helpers.MSG_RELIABLE) != 0; - header.Resent = (flags & Helpers.MSG_RESENT) != 0; - header.Zerocoded = (flags & Helpers.MSG_ZEROCODED) != 0; - header.Sequence = (uint)((bytes[pos + 1] << 24) + (bytes[pos + 2] << 16) + (bytes[pos + 3] << 8) + bytes[pos + 4]); - - // Set the frequency and packet ID number - if (bytes[pos + 6] == 0xFF) - { - if (bytes[pos + 7] == 0xFF) - { - header.Frequency = PacketFrequency.Low; - if (header.Zerocoded && bytes[pos + 8] == 0) - header.ID = bytes[pos + 10]; - else - header.ID = (ushort)((bytes[pos + 8] << 8) + bytes[pos + 9]); - - pos += 10; - } - else - { - header.Frequency = PacketFrequency.Medium; - header.ID = bytes[pos + 7]; - - pos += 8; - } - } - else - { - header.Frequency = PacketFrequency.High; - header.ID = bytes[pos + 6]; - - pos += 7; - } - - header.AckList = null; - CreateAckList(ref header, bytes, ref packetEnd); - - return header; - } - - /// - /// - /// - /// - /// - /// - static void CreateAckList(ref Header header, byte[] bytes, ref int packetEnd) - { - if (header.AppendedAcks) - { - int count = bytes[packetEnd--]; - header.AckList = new uint[count]; - - for (int i = 0; i < count; i++) - { - header.AckList[i] = (uint)( - (bytes[(packetEnd - i * 4) - 3] << 24) | - (bytes[(packetEnd - i * 4) - 2] << 16) | - (bytes[(packetEnd - i * 4) - 1] << 8) | - (bytes[(packetEnd - i * 4) ])); - } - - packetEnd -= (count * 4); - } - } - } - - /// - /// A block of data in a packet. Packets are composed of one or more blocks, - /// each block containing one or more fields - /// - public abstract class PacketBlock - { - /// Current length of the data in this packet - public abstract int Length { get; } - - /// - /// Create a block from a byte array - /// - /// Byte array containing the serialized block - /// Starting position of the block in the byte array. - /// This will point to the data after the end of the block when the - /// call returns - public abstract void FromBytes(byte[] bytes, ref int i); - - /// - /// Serialize this block into a byte array - /// - /// Byte array to serialize this block into - /// Starting position in the byte array to serialize to. - /// This will point to the position directly after the end of the - /// serialized block when the call returns - public abstract void ToBytes(byte[] bytes, ref int i); - } diff --git a/Programs/mapgenerator/unusedpackets.txt b/Programs/mapgenerator/unusedpackets.txt deleted file mode 100644 index 5fbb20fd..00000000 --- a/Programs/mapgenerator/unusedpackets.txt +++ /dev/null @@ -1,124 +0,0 @@ -AddCircuitCode -RelayLogControl -NeighborList -SimulatorAssign -SpaceServerSimulatorTimeMessage -ClosestSimulator -AvatarTextureUpdate -SimulatorMapUpdate -SimulatorSetMap -SubscribeLoad -UnsubscribeLoad -SimulatorStart -SimulatorReady -SimulatorPresentAtLocation -SimulatorLoad -SimulatorShutdownRequest -RegionPresenceRequestByRegionID -RegionPresenceRequestByHandle -RegionPresenceResponse -RecordAgentPresence -EraseAgentPresence -AgentPresenceRequest -AgentPresenceResponse -UpdateSimulator -TrackAgentSession -ClearAgentSessions -LogDwellTime -FeatureDisabled -LogFailedMoneyTransaction -UserReportInternal -SetSimStatusInDatabase -SetSimPresenceInDatabase -AvatarPickerRequestBackend -DirFindQueryBackend -DirPlacesQueryBackend -DirClassifiedQueryBackend -DirPicksQueryBackend -DirLandQueryBackend -DirPopularQueryBackend -OnlineStatusRequest -OnlineStatusReply -GroupNoticeAdd -DataHomeLocationRequest -DataHomeLocationReply -SpaceLocationTeleportRequest -SpaceLocationTeleportReply -CompleteLure -AddModifyAbility -RemoveModifyAbility -NearestLandingRegionRequest -NearestLandingRegionReply -NearestLandingPointUpdated -TeleportLandingStatusChanged -SystemKickUser -AvatarPropertiesRequestBackend -RequestParcelTransfer -UpdateParcel -RemoveParcel -MergeParcel -LogParcelChanges -CheckParcelSales -ParcelSales -StartAuction -ConfirmAuctionStart -CompleteAuction -CancelAuction -CheckParcelAuctions -ParcelAuctions -ChatPass -EdgeDataPacket -SimStatus -PassObject -AtomicPassObject -KillChildAgents -LogLogin -DataServerLogout -TransferInventory -TransferInventoryAck -EventLocationRequest -EventLocationReply -MoneyTransferBackend -BulkMoneyTransfer -SetStartLocation -NetTest -SetCPURatio -SimCrashed -NameValuePair -RemoveNameValuePair -GetNameValuePair -UpdateAttachment -RemoveAttachment -EmailMessageRequest -EmailMessageReply -InternalScriptMail -ScriptDataRequest -ScriptDataReply -InviteGroupResponse -TallyVotes -LogTextMessage -StartExpungeProcess -StartExpungeProcessAck -StartParcelRename -StartParcelRenameAck -BulkParcelRename -ParcelRename -StartParcelRemove -BulkParcelRemove -RpcChannelRequest -RpcChannelReply -RpcScriptRequestInbound -RpcScriptRequestInboundForward -RpcScriptReplyInbound -MailTaskSimRequest -MailTaskSimReply -ScriptMailRegistration -NearestLandingRegionUpdated -KickUserAck -RequestInventoryAsset -InventoryAssetResponse -FormFriendship -CreateTrustedCircuit -DenyTrustedCircuit -RequestTrustedCircuit -SystemMessage \ No newline at end of file