mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-22 05:48:37 +00:00
This commit is contained in:
parent
f19e133ef6
commit
e2a3fe1758
9 changed files with 104 additions and 48 deletions
|
|
@ -136,6 +136,7 @@
|
|||
<Compile Include="SubPropertyPageBase.Designer.cs">
|
||||
<DependentUpon>SubPropertyPageBase.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Templates\GenerateCosmosProjectWizard.cs" />
|
||||
<Compile Include="Templates\GenerateGuidsWizard.cs" />
|
||||
<Compile Include="Templates\UseGuidsWizard.cs" />
|
||||
<Compile Include="TitleDivision.cs">
|
||||
|
|
@ -174,37 +175,33 @@
|
|||
<None Include="Key.snk" />
|
||||
<Content Include="PLKResponse.html" />
|
||||
<Content Include="Resources\Cosmos.ico" />
|
||||
<Content Include="Templates\Projects\CosmosProject %28C#%29\Readme.txt" />
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\CosmosProject.vstemplate">
|
||||
<RootPath>Templates\Projects\CosmosProject %28C#%29</RootPath>
|
||||
</ZipItem>
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\Kernel.ico">
|
||||
<RootPath>Templates\Projects\CosmosProject %28C#%29</RootPath>
|
||||
</ZipItem>
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\ProjKernel\CSharpProj.vstemplate">
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\Readme.txt">
|
||||
<RootPath>Templates\Projects\CosmosProject %28C#%29</RootPath>
|
||||
</ZipItem>
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\ProjKernel\CSharpProject.csproj">
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\CSharpProj.vstemplate">
|
||||
<RootPath>Templates\Projects\CosmosProject %28C#%29</RootPath>
|
||||
</ZipItem>
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\ProjKernel\Kernel.ico">
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\CSharpProject.csproj">
|
||||
<RootPath>Templates\Projects\CosmosProject %28C#%29</RootPath>
|
||||
</ZipItem>
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\ProjKernel\AssemblyInfo.cs">
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\AssemblyInfo.cs">
|
||||
<RootPath>Templates\Projects\CosmosProject %28C#%29</RootPath>
|
||||
</ZipItem>
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\Proj\CosmosProj.vstemplate">
|
||||
<None Include="Templates\Projects\CosmosProject %28C#%29\Proj\CosmosProj.vstemplate">
|
||||
<RootPath>Templates\Projects\CosmosProject %28C#%29</RootPath>
|
||||
</None>
|
||||
<EmbeddedResource Include="Templates\CosmosProject.Cosmos">
|
||||
<RootPath>Templates\Projects\CosmosProject %28C#%29</RootPath>
|
||||
</EmbeddedResource>
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\Kernel.cs">
|
||||
<RootPath>Templates\Projects\CosmosProject %28C#%29</RootPath>
|
||||
</ZipItem>
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\Proj\CosmosProject.Cosmos">
|
||||
<None Include="Templates\Projects\CosmosProject %28C#%29\Proj\Kernel.ico">
|
||||
<RootPath>Templates\Projects\CosmosProject %28C#%29</RootPath>
|
||||
</ZipItem>
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\ProjKernel\Kernel.cs">
|
||||
<RootPath>Templates\Projects\CosmosProject %28C#%29</RootPath>
|
||||
</ZipItem>
|
||||
<ZipItem Include="Templates\Projects\CosmosProject %28C#%29\Proj\Kernel.ico">
|
||||
<RootPath>Templates\Projects\CosmosProject %28C#%29</RootPath>
|
||||
</ZipItem>
|
||||
</None>
|
||||
<EmbeddedResource Include="BuildPage.resx">
|
||||
<DependentUpon>BuildPage.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>$GeneratedGuid1$</ProjectGuid>
|
||||
<ProjectGuid>$CosmosProjGuid$</ProjectGuid>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<Name>$safeprojectname$</Name>
|
||||
<Name>$CosmosProjectName$</Name>
|
||||
<BinFormat>elf</BinFormat>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
|
|
@ -32,12 +32,11 @@
|
|||
<StartCosmosGDB>false</StartCosmosGDB>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\$safeprojectname$Kernel\$safeprojectname$Kernel.csproj">
|
||||
<Name>$safeprojectname$Kernel</Name>
|
||||
<Project>$GeneratedGuid2$</Project>
|
||||
<ProjectReference Include=".\$KernelName$.csproj">
|
||||
<Name>$KernelName$</Name>
|
||||
<Project>$KernelGuid$</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="$(MSBuildExtensionsPath)\Cosmos\Cosmos.targets" />
|
||||
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.VisualStudio.TemplateWizard;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace Cosmos.VS.Package.Templates
|
||||
{
|
||||
public class GenerateCosmosProjectWizard: IWizard
|
||||
{
|
||||
public void BeforeOpeningFile(EnvDTE.ProjectItem projectItem)
|
||||
{
|
||||
}
|
||||
|
||||
private static string GetTemplateString()
|
||||
{
|
||||
var xAsm = typeof(GenerateCosmosProjectWizard).Assembly;
|
||||
using (var xStream = xAsm.GetManifestResourceStream(typeof(GenerateCosmosProjectWizard), "CosmosProject.Cosmos"))
|
||||
{
|
||||
if (xStream == null)
|
||||
{
|
||||
MessageBox.Show("Could not find template manifest stream!");
|
||||
return null;
|
||||
}
|
||||
using (var xReader = new StreamReader(xStream))
|
||||
{
|
||||
return xReader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ProjectFinishedGenerating(EnvDTE.Project project)
|
||||
{
|
||||
//project.DTE.Solution
|
||||
var xInputString = GetTemplateString();
|
||||
if (xInputString == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
xInputString = xInputString.Replace("$KernelGuid$", mGuidKernel.ToString("b"));
|
||||
xInputString = xInputString.Replace("$CosmosProjGuid$", mGuidCosmosProj.ToString("b"));
|
||||
xInputString = xInputString.Replace("$KernelName$", project.Name);
|
||||
xInputString = xInputString.Replace("$CosmosProjectName$", project.Name + "Boot");
|
||||
var xFilename = Path.GetDirectoryName(project.FullName);
|
||||
xFilename = Path.Combine(xFilename, project.Name + "Boot");
|
||||
xFilename += ".Cosmos";
|
||||
File.WriteAllText(xFilename, xInputString);
|
||||
project.DTE.Solution.AddFromFile(xFilename, false);
|
||||
}
|
||||
|
||||
public void ProjectItemFinishedGenerating(EnvDTE.ProjectItem projectItem)
|
||||
{
|
||||
}
|
||||
|
||||
public void RunFinished()
|
||||
{
|
||||
}
|
||||
|
||||
private Guid mGuidKernel;
|
||||
private Guid mGuidCosmosProj;
|
||||
|
||||
public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
|
||||
{
|
||||
mGuidKernel = Guid.NewGuid();
|
||||
mGuidCosmosProj = Guid.NewGuid();
|
||||
replacementsDictionary.Add("$KernelGuid$", mGuidKernel.ToString("B"));
|
||||
replacementsDictionary.Add("$CosmosProjGuid$", mGuidCosmosProj.ToString("B"));
|
||||
|
||||
}
|
||||
|
||||
public bool ShouldAddProjectItem(string filePath)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
<VSTemplate Version="2.0.0" Type="Project" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
|
||||
<TemplateData>
|
||||
<Name>ProjKernel</Name>
|
||||
<Name>CSharp Kernel</Name>
|
||||
<Description>A project for creating a Cosmos Kernel</Description>
|
||||
<Icon>Kernel.ico</Icon>
|
||||
<ProjectType>CSharp</ProjectType>
|
||||
<ProjectType>Cosmos</ProjectType>
|
||||
<!--<SortOrder>50</SortOrder>
|
||||
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>
|
||||
<NumberOfParentCategoriesToRollUp>1</NumberOfParentCategoriesToRollUp>-->
|
||||
<CreateNewFolder>true</CreateNewFolder>
|
||||
<DefaultName>CosmosProjectKernel</DefaultName>
|
||||
<ProvideDefaultName>true</ProvideDefaultName>-->
|
||||
<ProvideDefaultName>true</ProvideDefaultName>
|
||||
</TemplateData>
|
||||
<TemplateContent>
|
||||
<Project File="CSharpProject.csproj" ReplaceParameters="true">
|
||||
|
|
@ -18,6 +18,6 @@
|
|||
</TemplateContent>
|
||||
<WizardExtension>
|
||||
<Assembly>Cosmos.VS.Package, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f4d94ac959d59ec3</Assembly>
|
||||
<FullClassName>Cosmos.VS.Package.Templates.Wizards.GenerateGuidsWizard</FullClassName>
|
||||
<FullClassName>Cosmos.VS.Package.Templates.GenerateCosmosProjectWizard</FullClassName>
|
||||
</WizardExtension>
|
||||
</VSTemplate>
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>$GeneratedGuid2$</ProjectGuid>
|
||||
<ProjectGuid>$KernelGuid$</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>$safeprojectname$</RootNamespace>
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<VSTemplate Version="2.0.0" Type="ProjectGroup" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
|
||||
<TemplateData>
|
||||
<Name>Cosmos Project</Name>
|
||||
<Description>A project for creating a Cosmos Kernel</Description>
|
||||
<Icon>Kernel.ico</Icon>
|
||||
<ProjectType>Cosmos</ProjectType>
|
||||
<SortOrder>50</SortOrder>
|
||||
</TemplateData>
|
||||
<TemplateContent>
|
||||
<ProjectCollection>
|
||||
<ProjectTemplateLink ProjectName="$safeprojectname$Kernel">
|
||||
ProjKernel\CSharpProj.vstemplate
|
||||
</ProjectTemplateLink>
|
||||
<ProjectTemplateLink ProjectName="$safeprojectname$">
|
||||
Proj\CosmosProj.vstemplate
|
||||
</ProjectTemplateLink>
|
||||
</ProjectCollection>
|
||||
</TemplateContent>
|
||||
</VSTemplate>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB |
Loading…
Reference in a new issue