Skip to content

Commit

Permalink
dotnet templates
Browse files Browse the repository at this point in the history
  • Loading branch information
nkast committed Sep 10, 2024
1 parent 173c44a commit ad7fae6
Show file tree
Hide file tree
Showing 21 changed files with 236 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://learn.microsoft.com/en-us/dotnet/core/tutorials/cli-templates-create-template-package?pivots=dotnet-8-0
1 change: 1 addition & 0 deletions Templates/dotnetTemplates/Install.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dotnet new install .\
4 changes: 4 additions & 0 deletions Templates/dotnetTemplates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- Provide an overview of what your template package does and how to get started.
Consider previewing the README before uploading (https://learn.microsoft.com/en-us/nuget/nuget-org/package-readme-on-nuget-org#preview-your-readme). -->


1 change: 1 addition & 0 deletions Templates/dotnetTemplates/Uninstall.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dotnet new uninstall .\
1 change: 1 addition & 0 deletions Templates/dotnetTemplates/UpdateVSCache.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe" /updateconfiguration
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": " https://json.schemastore.org/ide.host",
"icon": "TemplateIcon.png",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "KNI Engine",
"classifications": [ "Common", "Console" ],
"identity": "nkast.Kni.ContentPipelineExtension.CSharp",
"name": "KNI Content Pipeline Extension Project (.NetStandard)",
"shortName": "KniContentPipelineExtensionNetStandard",
"sourceName": "KniContentPipelineExtension",
"tags": {
"language": "C#",
"type": "project"
},
"icon": "TemplateIcon.png"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Microsoft.Xna.Framework.Content.Pipeline;

using TInput = System.String;
using TOutput = System.String;

namespace KniContentPipelineExtension
{
/// <summary>
/// This class will be instantiated by the XNA Framework Content Pipeline
/// to import a file from disk into the specified type, TImport.
///
/// This should be part of a Content Pipeline Extension Library project.
///
/// TODO: change the ContentImporter attribute to specify the correct file
/// extension, display name, and default processor for this importer.
/// </summary>

[ContentImporter(".xyz", DisplayName = "XYZ Importer", DefaultProcessor = "ContentProcessor1")]
public class ContentImporter1 : ContentImporter<TInput>
{

public override TInput Import(string filename, ContentImporterContext context)
{
// TODO: process the input object, and return the modified data.
throw new NotImplementedException();
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<EnableDefaultItems>false</EnableDefaultItems>
<TargetFramework>netstandard2.0</TargetFramework>
<ProjectGuid>{$guid1$}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>KniContentPipelineExtension</RootNamespace>
<AssemblyName>KniContentPipelineExtension</AssemblyName>
<OutputPath>bin\$(Platform)\$(Configuration)\</OutputPath>
<DefineConstants>$(DefineConstants);</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nkast.Xna.Framework" Version="3.13.9001" />
<PackageReference Include="nkast.Xna.Framework.Content" Version="3.13.9001" />
<PackageReference Include="nkast.Xna.Framework.Graphics" Version="3.13.9001" />
<PackageReference Include="nkast.Xna.Framework.Content.Pipeline" Version="3.13.9001" />
<PackageReference Include="nkast.Xna.Framework.Content.Pipeline.Graphics" Version="3.13.9001" />
<PackageReference Include="nkast.Xna.Framework.Content.Pipeline.Audio" Version="3.13.9001" />
<PackageReference Include="nkast.Xna.Framework.Content.Pipeline.Media" Version="3.13.9001" />
</ItemGroup>

<ItemGroup>
<Compile Include="ContentImporter1.cs" />
<Compile Include="ContentProcessor1.cs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using Microsoft.Xna.Framework.Content.Pipeline;
// TODO: replace these with the processor input and output types.
using TInput = System.String;
using TOutput = System.String;

namespace KniContentPipelineExtension
{
/// <summary>
/// This class will be instantiated by the XNA Framework Content Pipeline
/// to apply custom processing to content data, converting an object of
/// type TInput to TOutput. The input and output types may be the same if
/// the processor wishes to alter data without changing its type.
///
/// This should be part of a Content Pipeline Extension Library project.
///
/// TODO: change the ContentProcessor attribute to specify the correct
/// display name for this processor.
/// </summary>
[ContentProcessor(DisplayName = "KniContentPipelineExtension.ContentProcessor1")]
public class ContentProcessor1 : ContentProcessor<TInput, TOutput>
{
public override TOutput Process(TInput input, ContentProcessorContext context)
{
// TODO: process the input object, and return the modified data.
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<Project>

</Project>

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": " https://json.schemastore.org/ide.host",
"icon": "TemplateIcon.png",

"defaultItemExtension": "cs",
"itemHierarchyPaths": [ "Code" ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "KNI Engine",
"classifications": [ "Common", "Code" ],
"identity": "nkast.Kni.GameComponent.CSharp",
"name": "KNI GameComponent Item",
"shortName": "KniGameComponent",
"tags": {
"language": "C#",
"type": "item"
},
"symbols": {
"ClassName":{
"type": "parameter",
"description": "The name of the code file and class.",
"datatype": "text",
"replaces": "GameComponent1",
"fileRename": "GameComponent1",
"defaultValue": "GameComponent1"
}
},
"icon": "TemplateIcon.png"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace KniGameComponent
{
internal class GameComponent1 : GameComponent
{
public GameComponent1(Game game) : base(game)
{
}

/// <summary>Initializes the component. Used to load non-graphical resources.</summary>
public override void Initialize()
{
base.Initialize();
}

/// <summary>Update the component.</summary>
/// <param name="gameTime">GameTime of the Game.</param>
public override void Update(GameTime gameTime)
{
}

}
}
1 change: 1 addition & 0 deletions Templates/dotnetTemplates/installPackage.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dotnet new install .\bin\Release\nkast.Kni.Templates.3.13.9001.nupkg
42 changes: 42 additions & 0 deletions Templates/dotnetTemplates/nkast.Kni.Templates.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<!-- The package metadata. Fill in the properties marked as TODO below -->
<!-- Follow the instructions on https://learn.microsoft.com/en-us/nuget/create-packages/package-authoring-best-practices -->
<PackageId>nkast.Kni.Templates</PackageId>
<PackageVersion>3.13.9001</PackageVersion>
<Title>TODO: fill the package name here</Title>
<Authors>KNI Engine</Authors>
<Description>TODO: fill the package description here</Description>
<PackageTags>TODO: fill the tags here</PackageTags>
<PackageProjectUrl>https://github.com/kniEngine/kni/</PackageProjectUrl>

<!-- Keep package type as 'Template' to show the package as a template package on nuget.org and make your template available in dotnet new search.-->
<PackageType>Template</PackageType>
<TargetFramework>net8.0</TargetFramework>
<IncludeContentInPack>true</IncludeContentInPack>
<IncludeBuildOutput>false</IncludeBuildOutput>
<ContentTargetFolders>content</ContentTargetFolders>
<NoWarn>$(NoWarn);NU5128</NoWarn>
<NoDefaultExcludes>true</NoDefaultExcludes>
<PackageReadmeFile>README.md</PackageReadmeFile>
</PropertyGroup>

<PropertyGroup>
<LocalizeTemplates>false</LocalizeTemplates>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.TemplateEngine.Tasks" Version="*" PrivateAssets="all" IsImplicitlyDefined="true"/>
</ItemGroup>

<ItemGroup>
<Content Include="content\**\*" Exclude="content\**\bin\**;content\**\obj\**" />
<Compile Remove="**\*" />
</ItemGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions Templates/dotnetTemplates/pack.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dotnet pack
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://github.com/dotnet/templating/tree/main/dotnet-template-samples/content
1 change: 1 addition & 0 deletions Templates/dotnetTemplates/uninstallPackage.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dotnet new uninstall nkast.Kni.Templates

0 comments on commit ad7fae6

Please sign in to comment.