Go Back   RunUO - Ultima Online Emulation > RunUO > Utility Support > Third Party Program Support

Third Party Program Support Misc support forum and advertisment forum for all RunUO related third party Utilities.

Reply
 
Thread Tools Display Modes
Old 12-16-2004, 12:46 AM   #1 (permalink)
Forum Novice
 
Join Date: Mar 2003
Location: Canada, eh?
Age: 23
Posts: 466
Default Project Creator Source

I'm not doing anything with my Project Creator anymore, so I thought I'd post the source code for it, in case anyone feels like adding new features to it (though I can't really think of any features it would need, maybe say a project convertor from SharpDevelop -> VS2K3, or something like that)

Credits go to Phantom for his creation of the Project Generator, which gave me the inspiration to make this little one (I made mine initially to create VS2K5 Beta projects, though I added support for the other ones just as something to do)

Edit: Updated with a binary version uploaded, to save people compiling it to check it out.

Here's the source:

Constants.cs
Code:
#region Using directives

using System;

#endregion

namespace RunUO_Project_Creator.Constants
{
    public class VS2K5
    {
        public static string[] projectHeader =
        {
            "<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">",
            "  <PropertyGroup>",
            "    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>",
            "    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>",
            "    <ProductVersion>8.0.40607</ProductVersion>",
            "    <SchemaVersion>2.0</SchemaVersion>",
            "    <ProjectGuid>{B2EAB854-8907-43BE-9B8F-9B1B64DDF597}</ProjectGuid>",
            "    <OutputType>Library</OutputType>",
            "    <RootNamespace>Scripts</RootNamespace>",
            "    <AssemblyName>Scripts</AssemblyName>",
            "    <WarningLevel>4</WarningLevel>",
            "  </PropertyGroup>",
            "  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">",
            "    <DebugSymbols>true</DebugSymbols>",
            "    <DebugType>full</DebugType>",
            "    <Optimize>false</Optimize>",
            "    <OutputPath>.\\bin\\Debug\\</OutputPath>",
            "    <DefineConstants>DEBUG;TRACE</DefineConstants>",
            "  </PropertyGroup>",
            "  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">",
            "    <DebugSymbols>false</DebugSymbols>",
            "    <Optimize>true</Optimize>",
            "    <OutputPath>.\\bin\\Release\\</OutputPath>",
            "    <DefineConstants>TRACE</DefineConstants>",
            "  </PropertyGroup>",
            "  <ItemGroup>"
        };

        public static string[] projectEnd =
        {
            "  </ItemGroup>",
            "  <ItemGroup>",
            "    <Reference Include=\"RunUO.exe.dll\" />",
            "    <Reference Include=\"System\" />",
            "    <Reference Include=\"System.Data\" />",
            "    <Reference Include=\"System.Web\" />",
            "    <Reference Include=\"System.Xml\" />",
            "  </ItemGroup>",
            "    <Import Project=\"$(MSBuildBinPath)\\Microsoft.CSHARP.Targets\" />",
            "</Project>"
        };
    }

    public class VS2K3
    {
        public static string[] projectHeader =
        {
            "<VisualStudioProject>",
            "  <CSHARP ProjectType = \"Local\" ProductVersion = \"7.10.3077\" SchemaVersion = \"2.0\" ProjectGuid = \"{B2EAB854-8907-43BE-9B8F-9B1B64DDF597}\">",
            "    <Build>",
            "      <Settings ApplicationIcon=\"\" AssemblyKeyContainerName=\"\" AssemblyName=\"scripts\" AssemblyOriginatorKeyFile=\"\" DefaultClientScript=\"JScript\"",
            "        DefaultHTMLPageLayout=\"Grid\" DefaultTargetSchema=\"IE50\" DelaySign=\"false\" OutputType=\"Library\" PreBuildEvent=\"\" PostBuildEvent=\"\" RootNamespace=\"scripts\" RunPostBuildEvent=\"OnBuildSuccess\" StartupObject=\"\">",
            "        <Config Name=\"Debug\" AllowUnsafeBlocks=\"false\" BaseAddress=\"285212672\" CheckForOverflowUnderflow=\"false\" ConfigurationOverrideFile=\"\" DefineConstants=\"DEBUG;TRACE\" DocumentationFile=\"\" DebugSymbols=\"true\" FileAlignment=\"4096\" IncrementalBuild=\"false\" NoStdLib=\"false\" NoWarn=\"\" Optimize=\"false\" OutputPath=\"bin\\Debug\\\" RegisterForComInterop=\"false\" RemoveIntegerChecks=\"false\" TreatWarningsAsErrors=\"false\" WarningLevel=\"4\" />",
            "        <Config Name=\"Release\" AllowUnsafeBlocks=\"false\" BaseAddress=\"285212672\" CheckForOverflowUnderflow=\"false\" ConfigurationOverrideFile=\"\" DefineConstants=\"TRACE\" DocumentationFile=\"\" DebugSymbols=\"false\" FileAlignment=\"4096\" IncrementalBuild=\"false\" NoStdLib=\"false\" NoWarn=\"\" Optimize=\"true\" OutputPath=\"bin\\Release\\\" RegisterForComInterop=\"false\" RemoveIntegerChecks=\"false\" TreatWarningsAsErrors=\"false\" WarningLevel=\"4\" />",
            "      </Settings>",
            "      <References>",
            "        <Reference Name=\"RunUO.exe.dll\" AssemblyName=\"RunUO.exe.dll\" HintPath=\".\\RunUO.exe.dll\" />",
            "        <Reference Name=\"System\" AssemblyName=\"System\" HintPath=\"..\\WINNT\\Microsoft.NET\\Framework\\v1.1.4322\\System.dll\" />",
            "        <Reference Name=\"System.XML\" AssemblyName=\"System.XML\" HintPath=\"..\\WINNT\\Microsoft.NET\\Framework\\v1.1.4322\\System.XML.dll\" />",
            "        <Reference Name=\"System.Data\" AssemblyName=\"System.Data\" HintPath=\"..\\WINNT\\Microsoft.NET\\Framework\\v1.1.4322\\System.Data.dll\" />",
            "        <Reference Name=\"System.Web\" AssemblyName=\"System.Web\" HintPath=\"..\\WINNT\\Microsoft.NET\\Framework\\v1.1.4322\\System.Web.dll\" />",
            "      </References>",
            "    </Build>",
            "    <Files>",
            "      <Include>"
        };

        public static string[] projectEnd =
        {
            "      </Include>",
            "    </Files>",
            "  </CSHARP>",
            "</VisualStudioProject>"
        };
    }

    public class VS2K2
    {
        public static string[] projectHeader =
        {
            "<VisualStudioProject>",
            "  <CSHARP ProjectType=\"Local\" ProductVersion=\"7.0.9466\" SchemaVersion=\"1.0\" ProjectGuid=\"{B2EAB854-8907-43BE-9B8F-9B1B64DDF597}\">",
            "    <Build>",
            "      <Settings ApplicationIcon=\"\" AssemblyKeyContainerName=\"\" AssemblyName=\"scripts\" AssemblyOriginatorKeyFile=\"\" DefaultClientScript=\"JScript\" DefaultHTMLPageLayout=\"Grid\" DefaultTargetSchema=\"IE50\" DelaySign=\"false\" OutputType=\"Exe\" PreBuildEvent=\"\" PostBuildEvent=\"\" RootNamespace=\"scripts\" RunPostBuildEvent=\"OnBuildSuccess\" StartupObject=\"\">",
            "        <Config Name=\"Debug\" AllowUnsafeBlocks=\"false\" BaseAddress=\"285212672\" CheckForOverflowUnderflow=\"false\" ConfigurationOverrideFile=\"\" DefineConstants=\"DEBUG;TRACE\" DocumentationFile=\"\" DebugSymbols=\"true\" FileAlignment=\"4096\" IncrementalBuild=\"false\" NoStdLib=\"false\" NoWarn=\"\" Optimize=\"false\" OutputPath=\"bin\\Debug\" RegisterForComInterop=\"false\" RemoveIntegerChecks=\"false\" TreatWarningsAsErrors=\"false\" WarningLevel=\"4\" />",
            "        <Config Name=\"Release\" AllowUnsafeBlocks=\"false\" BaseAddress=\"285212672\" CheckForOverflowUnderflow=\"false\" ConfigurationOverrideFile=\"\" DefineConstants=\"TRACE\" DocumentationFile=\"\" DebugSymbols=\"false\" FileAlignment=\"4096\" IncrementalBuild=\"false\" NoStdLib=\"false\" NoWarn=\"\" Optimize=\"true\" OutputPath=\"bin\\Release\" RegisterForComInterop=\"false\" RemoveIntegerChecks=\"false\" TreatWarningsAsErrors=\"false\" WarningLevel=\"4\" />",
            "      </Settings>",
            "      <References>",
            "        <Reference Name=\"RunUO.exe.dll\" AssemblyName=\"RunUO.exe.dll\" HintPath=\"RunUO.exe.dll\" />",
            "        <Reference Name=\"System\" AssemblyName=\"System\" HintPath=\"..\\WINNT\\Microsoft.NET\\Framework\\v1.1.4322\\System.dll\" />",
            "        <Reference Name=\"System.XML\" AssemblyName=\"System.XML\" HintPath=\"..\\WINNT\\Microsoft.NET\\Framework\\v1.1.4322\\System.XML.dll\" />",
            "        <Reference Name=\"System.Data\" AssemblyName=\"System.Data\" HintPath=\"..\\WINNT\\Microsoft.NET\\Framework\\v1.1.4322\\System.Data.dll\" />",
            "        <Reference Name=\"System.Web\" AssemblyName=\"System.Web\" HintPath=\"..\\WINNT\\Microsoft.NET\\Framework\\v1.1.4322\\System.Web.dll\" />",
            "      </References>",
            "    </Build>",
            "    <Files>",
            "      <Include>"
        };

        public static string[] projectEnd =
        {
            "      </Include>",
            "    </Files>",
            "  </CSHARP>",
            "</VisualStudioProject>",
        };
    }

    public class SharpDevelop
    {
        public static string[] projectHeader =
        {
            "<Project name=\"SharpDevelop\" standardNamespace=\"SharpDevelop\" description=\"\" newfilesearch=\"None\" enableviewstate=\"True\" version=\"1.1\" projecttype=\"C#\">",
            "  <Contents>"
        };

        public static string[] projectEnd =
        {
            "  </Contents>",
            "  <References>",
            "    <Reference type=\"Assembly\" refto=\".\\RunUO.exe.dll\" localcopy=\"True\" />",
            "    <Reference type=\"Gac\" refto=\"System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" localcopy=\"True\" />",
            "    <Reference type=\"Gac\" refto=\"System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" localcopy=\"True\" />",
            "    <Reference type=\"Gac\" refto=\"System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\" localcopy=\"True\" />",
            "    <Reference type=\"Gac\" refto=\"System.Xml, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" localcopy=\"True\" />",
            "  </References>",
            "  <DeploymentInformation target=\"\" script=\"\" strategy=\"File\" />",
            "  <Configuration runwithwarnings=\"True\" name=\"Debug\">",
            "    <CodeGeneration runtime=\"MsNet\" compiler=\"Csc\" compilerversion=\"\" warninglevel=\"4\" nowarn=\"\" includedebuginformation=\"True\" optimize=\"False\" unsafecodeallowed=\"False\" generateoverflowchecks=\"True\" mainclass=\"\" target=\"Library\" definesymbols=\"\" generatexmldocumentation=\"False\" win32Icon=\"\" noconfig=\"False\" nostdlib=\"False\" />",
            "    <Execution commandlineparameters=\"\" consolepause=\"False\" />",
            "    <Output directory=\".\\bin\\Debug\" assembly=\"SharpDevelop\" executeScript=\"\" executeBeforeBuild=\"\" executeAfterBuild=\"\" executeBeforeBuildArguments=\"\" executeAfterBuildArguments=\"\" />",
            "  </Configuration>",
            "  <Configurations active=\"Debug\">",
            "    <Configuration runwithwarnings=\"True\" name=\"Debug\">",
            "      <CodeGeneration runtime=\"MsNet\" compiler=\"Csc\" compilerversion=\"\" warninglevel=\"4\" nowarn=\"\" includedebuginformation=\"True\" optimize=\"False\" unsafecodeallowed=\"False\" generateoverflowchecks=\"True\" mainclass=\"\" target=\"Library\" definesymbols=\"\" generatexmldocumentation=\"False\" win32Icon=\"\" noconfig=\"False\" nostdlib=\"False\" />",
            "      <Execution commandlineparameters=\"\" consolepause=\"False\" />",
            "      <Output directory=\".\\bin\\Debug\" assembly=\"SharpDevelop\" executeScript=\"\" executeBeforeBuild=\"\" executeAfterBuild=\"\" executeBeforeBuildArguments=\"\" executeAfterBuildArguments=\"\" />",
            "    </Configuration>",
            "    <Configuration runwithwarnings=\"True\" name=\"Release\">",
            "      <CodeGeneration runtime=\"MsNet\" compiler=\"Csc\" compilerversion=\"\" warninglevel=\"4\" nowarn=\"\" includedebuginformation=\"False\" optimize=\"True\" unsafecodeallowed=\"False\" generateoverflowchecks=\"False\" mainclass=\"\" target=\"Library\" definesymbols=\"\" generatexmldocumentation=\"False\" win32Icon=\"\" noconfig=\"False\" nostdlib=\"False\" />",
            "      <Execution commandlineparameters=\"\" consolepause=\"False\" />",
            "      <Output directory=\".\\bin\\Release\" assembly=\"SharpDevelop\" executeScript=\"\" executeBeforeBuild=\"\" executeAfterBuild=\"\" executeBeforeBuildArguments=\"\" executeAfterBuildArguments=\"\" />",
            "    </Configuration>",
            "  </Configurations>",
            "</Project>"
        };
    }
}
MainForm.cs
Code:
using System;
using System.IO;
using System.Drawing;
using System.Windows.Forms;

namespace RunUO_Project_Creator
{
	/// <summary>
	/// Description of MainForm.
	/// </summary>
	public class MainForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.CheckBox chkVS2K3;
		private System.Windows.Forms.CheckBox chkSharpDevelop;
		private System.Windows.Forms.CheckBox chkVS2K5;
		private System.Windows.Forms.CheckBox chkVS2K2;
		private System.Windows.Forms.Button btnCreateProjects;
		private System.Windows.Forms.Label label1;
		public MainForm()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
		}
		
		[STAThread]
		public static void Main(string[] args)
		{
			Application.Run(new MainForm());
		}
		
		#region Windows Forms Designer generated code
		/// <summary>
		/// This method is required for Windows Forms designer support.
		/// Do not change the method contents inside the source code editor. The Forms designer might
		/// not be able to load this method if it was changed manually.
		/// </summary>
		private void InitializeComponent() {
			this.label1 = new System.Windows.Forms.Label();
			this.btnCreateProjects = new System.Windows.Forms.Button();
			this.chkVS2K2 = new System.Windows.Forms.CheckBox();
			this.chkVS2K5 = new System.Windows.Forms.CheckBox();
			this.chkSharpDevelop = new System.Windows.Forms.CheckBox();
			this.chkVS2K3 = new System.Windows.Forms.CheckBox();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.label1.Location = new System.Drawing.Point(0, 80);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(224, 16);
			this.label1.TabIndex = 5;
			this.label1.Text = "Made by Tylius, for the RunUO community.";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// btnCreateProjects
			// 
			this.btnCreateProjects.Dock = System.Windows.Forms.DockStyle.Bottom;
			this.btnCreateProjects.Enabled = false;
			this.btnCreateProjects.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnCreateProjects.Location = new System.Drawing.Point(0, 96);
			this.btnCreateProjects.Name = "btnCreateProjects";
			this.btnCreateProjects.Size = new System.Drawing.Size(224, 24);
			this.btnCreateProjects.TabIndex = 4;
			this.btnCreateProjects.Text = "Create Project Files";
			this.btnCreateProjects.Click += new System.EventHandler(this.btnCreateProjectsClick);
			// 
			// chkVS2K2
			// 
			this.chkVS2K2.Dock = System.Windows.Forms.DockStyle.Top;
			this.chkVS2K2.Location = new System.Drawing.Point(0, 0);
			this.chkVS2K2.Name = "chkVS2K2";
			this.chkVS2K2.Size = new System.Drawing.Size(224, 16);
			this.chkVS2K2.TabIndex = 0;
			this.chkVS2K2.Text = "Visual Studio .NET 2002";
			this.chkVS2K2.CheckedChanged += new System.EventHandler(this.chkVS2K2CheckedChanged);
			// 
			// chkVS2K5
			// 
			this.chkVS2K5.Dock = System.Windows.Forms.DockStyle.Top;
			this.chkVS2K5.Location = new System.Drawing.Point(0, 32);
			this.chkVS2K5.Name = "chkVS2K5";
			this.chkVS2K5.Size = new System.Drawing.Size(224, 16);
			this.chkVS2K5.TabIndex = 2;
			this.chkVS2K5.Text = "Visual Studio .NET 2005 (Beta 1)";
			this.chkVS2K5.CheckedChanged += new System.EventHandler(this.ChkVS2K5CheckedChanged);
			// 
			// chkSharpDevelop
			// 
			this.chkSharpDevelop.Dock = System.Windows.Forms.DockStyle.Top;
			this.chkSharpDevelop.Location = new System.Drawing.Point(0, 48);
			this.chkSharpDevelop.Name = "chkSharpDevelop";
			this.chkSharpDevelop.Size = new System.Drawing.Size(224, 16);
			this.chkSharpDevelop.TabIndex = 3;
			this.chkSharpDevelop.Text = "Sharp Develop";
			this.chkSharpDevelop.CheckedChanged += new System.EventHandler(this.ChkSharpDevelopCheckedChanged);
			// 
			// chkVS2K3
			// 
			this.chkVS2K3.Dock = System.Windows.Forms.DockStyle.Top;
			this.chkVS2K3.Location = new System.Drawing.Point(0, 16);
			this.chkVS2K3.Name = "chkVS2K3";
			this.chkVS2K3.Size = new System.Drawing.Size(224, 16);
			this.chkVS2K3.TabIndex = 1;
			this.chkVS2K3.Text = "Visual Studio .NET 2003";
			this.chkVS2K3.CheckedChanged += new System.EventHandler(this.ChkVS2K3CheckedChanged);
			// 
			// MainForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
			this.ClientSize = new System.Drawing.Size(224, 120);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.btnCreateProjects);
			this.Controls.Add(this.chkSharpDevelop);
			this.Controls.Add(this.chkVS2K5);
			this.Controls.Add(this.chkVS2K3);
			this.Controls.Add(this.chkVS2K2);
			this.MaximizeBox = false;
			this.Name = "MainForm";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "RunUO Project Creator";
			this.ResumeLayout(false);
		}
		#endregion
		
		
		
		void btnCreateProjectsClick(object sender, System.EventArgs e)
		{
			if (File.Exists("RunUO.exe"))
                File.Copy("RunUO.exe", "RunUO.exe.dll", true);

            if (chkVS2K2.Checked == true)
                Projects.VS2K2.WriteProject("VS2K2.csproj");
            if (chkVS2K3.Checked == true)
                Projects.VS2K3.WriteProject("VS2K3.csproj");
            if (chkVS2K5.Checked == true)
                Projects.VS2K5.WriteProject("VS2K5.csproj");
            if (chkSharpDevelop.Checked == true)
                Projects.SharpDevelop.WriteProject("SharpDevelop.prjx");

            chkSharpDevelop.Checked = false;
            chkVS2K2.Checked = false;
            chkVS2K3.Checked = false;
            chkVS2K5.Checked = false;
		}
		
		void chkVS2K2CheckedChanged(object sender, System.EventArgs e)
		{
            RunCheck();
		}
		
		void ChkVS2K3CheckedChanged(object sender, System.EventArgs e)
		{
            RunCheck();
		}
		
		void ChkVS2K5CheckedChanged(object sender, System.EventArgs e)
		{
            RunCheck();
		}
		
		void ChkSharpDevelopCheckedChanged(object sender, System.EventArgs e)
		{
            RunCheck();
		}
		
		void RunCheck()
        {
            if (chkSharpDevelop.Checked == false && chkVS2K2.Checked == false &&
                chkVS2K3.Checked == false && chkVS2K5.Checked == false)
                btnCreateProjects.Enabled = false;
            else
                btnCreateProjects.Enabled = true;
		}
	}
}
Projects.cs
Code:
#region Using directives

using System;
using System.IO;
using System.Windows.Forms;

#endregion

namespace RunUO_Project_Creator.Projects
{
    public class SharpDevelop
    {
        public static void WriteProject(string filename)
        {
            FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write);
            StreamWriter sw = new StreamWriter(fs);
            
            try
            {
                foreach (string s in Constants.SharpDevelop.projectHeader)
                    sw.WriteLine(s);

                AddFiles(sw, @".\Scripts\");

                foreach (string s in Constants.SharpDevelop.projectEnd)
                    sw.WriteLine(s);

                sw.Close();
                fs.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            sw.Close();
            fs.Close();
        }

        public static void AddFiles(StreamWriter sw, string directory)
        {
            DirectoryInfo scriptDir = new DirectoryInfo(directory);
            DirectoryInfo[] dirs = scriptDir.GetDirectories();
            FileInfo[] files = scriptDir.GetFiles("*.cs");
            foreach (FileInfo file in files)
            {
                string filePath = scriptDir + "\\" + file.Name;
                sw.WriteLine("    <File name=\".\\" + filePath.Replace(@".\Scripts\", @"Scripts\").Replace(@"\\", @"\") + "\" subtype=\"Code\" buildaction=\"Compile\" dependson=\"\" data=\"\" />");
                sw.Flush();
            }

            foreach (DirectoryInfo dir in dirs)
            {
                AddFiles(sw, directory + dir + @"\");
            }
        }
    }

    public class VS2K2
    {
        public static void WriteProject(string filename)
        {
            FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write);
            StreamWriter sw = new StreamWriter(fs);
            
            try
            {
                foreach (string s in Constants.VS2K2.projectHeader)
                    sw.WriteLine(s);

                AddFiles(sw, @".\Scripts\");

                foreach (string s in Constants.VS2K2.projectEnd)
                    sw.WriteLine(s);

                sw.Close();
                fs.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            sw.Close();
            fs.Close();
        }

        public static void AddFiles(StreamWriter sw, string directory)
        {
            DirectoryInfo scriptDir = new DirectoryInfo(directory);
            DirectoryInfo[] dirs = scriptDir.GetDirectories();
            FileInfo[] files = scriptDir.GetFiles("*.cs");
            foreach (FileInfo file in files)
            {
                string filePath = scriptDir + "\\" + file.Name;
                sw.WriteLine("        <File RelPath=\"" + filePath.Replace(@".\Scripts\", @"Scripts\").Replace(@"\\", @"\") + "\" SubType=\"Code\" BuildAction=\"Compile\" />");
                sw.Flush();
            }

            foreach (DirectoryInfo dir in dirs)
            {
                AddFiles(sw, directory + dir + @"\");
            }
        }
    }

    public class VS2K3
    {
        public static void WriteProject(string filename)
        {
            FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write);
            StreamWriter sw = new StreamWriter(fs);
            
            try
            {
                foreach (string s in Constants.VS2K3.projectHeader)
                    sw.WriteLine(s);

                AddFiles(sw, @".\Scripts\");

                foreach (string s in Constants.VS2K3.projectEnd)
                    sw.WriteLine(s);

                sw.Close();
                fs.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            sw.Close();
            fs.Close();
        }

        public static void AddFiles(StreamWriter sw, string directory)
        {
            DirectoryInfo scriptDir = new DirectoryInfo(directory);
            DirectoryInfo[] dirs = scriptDir.GetDirectories();
            FileInfo[] files = scriptDir.GetFiles("*.cs");
            foreach (FileInfo file in files)
            {
                string filePath = scriptDir + "\\" + file.Name;
                sw.WriteLine("    <File RelPath=\"" + filePath.Replace(@".\Scripts\", @"Scripts\").Replace(@"\\", @"\") + "\" SubType=\"Code\" BuildAction=\"Compile\" />");
                sw.Flush();
            }

            foreach (DirectoryInfo dir in dirs)
            {
                AddFiles(sw, directory + dir + @"\");
            }
        }
    }

    public class VS2K5
    {
        public static void WriteProject(string filename)
        {
            FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write);
            StreamWriter sw = new StreamWriter(fs);
            
            try
            {
                foreach (string s in Constants.VS2K5.projectHeader)
                    sw.WriteLine(s);

                AddFiles(sw, @".\Scripts\");

                foreach (string s in Constants.VS2K5.projectEnd)
                    sw.WriteLine(s);

                sw.Close();
                fs.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            sw.Close();
            fs.Close();
        }

        private static void AddFiles(StreamWriter sw, string directory)
        {
            DirectoryInfo scriptDir = new DirectoryInfo(directory);
            DirectoryInfo[] dirs = scriptDir.GetDirectories();
            FileInfo[] files = scriptDir.GetFiles("*.cs");

            foreach (FileInfo file in files)
            {
                string filePath = scriptDir + "\\" + file.Name;
                sw.WriteLine("    <Compile Include=\"" + filePath.Replace(@".\Scripts\", @"Scripts\").Replace(@"\\", @"\") + "\" />");
                sw.Flush();
            }

            foreach (DirectoryInfo dir in dirs)
            {
                AddFiles(sw, directory + dir + @"\");
            }
        }
    }
}
I'll attach a zip file for anyone who doesn't feel like copying and pasting these
No credit is required if anyone wants to use any of this source in their code, I just hope that someone will find it useful
Attached Files
File Type: zip Project Creator.zip (4.4 KB, 94 views)
File Type: zip Project Creator with binary.zip (12.3 KB, 141 views)
__________________
Tylius Dragon --==(UDIC)==--
Tylius is offline   Reply With Quote
Old 12-23-2004, 10:10 AM   #2 (permalink)
Forum Expert
 
Join Date: Sep 2002
Age: 23
Posts: 1,472
Default

thx for the 2005 proj creator
Ravatar is offline   Reply With Quote
Old 12-23-2004, 04:07 PM   #3 (permalink)
Forum Novice
 
Join Date: Mar 2003
Location: Canada, eh?
Age: 23
Posts: 466
Default

Wow! Someone else actually uses 2005 also, I didn't expect that Glad that you find it useful!
__________________
Tylius Dragon --==(UDIC)==--
Tylius is offline   Reply With Quote
Old 12-23-2004, 04:15 PM   #4 (permalink)
Newbie
 
Join Date: Jun 2004
Age: 23
Posts: 63
Default

uhh what is project creator?
crameep is offline   Reply With Quote
Old 12-23-2004, 07:42 PM   #5 (permalink)
Forum Novice
 
Join Date: Mar 2003
Location: Canada, eh?
Age: 23
Posts: 466
Default

It creates project files for the RunUO Scripts directory, for use with Visual Studio 2002, 2003, 2005 Beta1, and SharpDevelop. If you don't use any of these for scripting, then this won't be of any use to you
__________________
Tylius Dragon --==(UDIC)==--
Tylius is offline   Reply With Quote
Old 12-30-2004, 11:31 AM   #6 (permalink)
 
Join Date: Dec 2004
Posts: 8
Default

Wait ... do you mean it creates project files, thereby giving you access to the spiffy features such as dot complete, class view, solution view, and definition jumps?
jdmx is offline   Reply With Quote
Old 12-30-2004, 02:54 PM   #7 (permalink)
Forum Novice
 
Join Date: Mar 2003
Location: Canada, eh?
Age: 23
Posts: 466
Default

Quote:
Originally Posted by jdmx
Wait ... do you mean it creates project files, thereby giving you access to the spiffy features such as dot complete, class view, solution view, and definition jumps?
Yes, that's what it does
__________________
Tylius Dragon --==(UDIC)==--
Tylius is offline   Reply With Quote
Old 12-30-2004, 04:01 PM   #8 (permalink)
 
Join Date: Dec 2004
Posts: 8
Default

Oooh. nice. That saves me an extra search/q.

This was actually like the third thing on my "to find out" list.

Woot!
jdmx is offline   Reply With Quote
Old 12-30-2004, 04:55 PM   #9 (permalink)
Forum Novice
 
Join Date: Mar 2003
Location: Canada, eh?
Age: 23
Posts: 466
Default

Glad to be of help
__________________
Tylius Dragon --==(UDIC)==--
Tylius is offline   Reply With Quote
Old 01-02-2005, 09:21 AM   #10 (permalink)
 
Join Date: Dec 2004
Posts: 8
Default

So I grabbed the zip files, and ran the .exe. I also went ahead and built the solution (using VS2k3).

It appears to have enabled solution and class viewing for all of the files, but no intellisense (dot completion). I did some searching and tried some of the initial suggestions, but to no avail.

Any suggestions?
jdmx is offline   Reply With Quote
Old 01-04-2005, 10:26 PM   #11 (permalink)
Forum Novice
 
Join Date: Mar 2003
Location: Canada, eh?
Age: 23
Posts: 466
Default

Hmm, I can't seem to find my copy of VS2K3 around, but the Intellisense works fine for me in VS2K5 Beta, and SharpDevelop (from what I remember), it could be that it's taking a while to load the information from the project, since there are so many files, I do remember it taking a little while for me
__________________
Tylius Dragon --==(UDIC)==--
Tylius is offline   Reply With Quote
Old 01-05-2005, 10:07 AM   #12 (permalink)
Forum Expert
 
Join Date: Nov 2002
Location: Shawinigan, Québec, Canada
Age: 25
Posts: 344
Default

Nobody is telling but using a solution/project with some option also allows you to debug scripts in the IDE (with watches and such) when using the -debug switch with RunUO.
ZixThree is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5