Skip to content

Commit

Permalink
split sample project into naked and CWM samples
Browse files Browse the repository at this point in the history
  • Loading branch information
nezroy committed Apr 17, 2015
1 parent 0629dee commit de87d97
Show file tree
Hide file tree
Showing 9 changed files with 167 additions and 12 deletions.
8 changes: 7 additions & 1 deletion CityWebServer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CityWebServer", "CityWebSer
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CityWebServer.Extensibility", "CityWebServer.Extensibility\CityWebServer.Extensibility.csproj", "{DB96EFB4-FA45-4ACC-8D51-7ED37065CC79}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleWebServerExtension", "SampleWebServerExtension\SampleWebServerExtension.csproj", "{7DF15DF6-C475-4866-9111-F5150C1336E1}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleNakedHandlerMod", "SampleNakedHandlerMod\SampleNakedHandlerMod.csproj", "{671CB9E5-3EFD-4466-935E-1BF58470296F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCityWebMod", "SampleCityWebMod\SampleCityWebMod.csproj", "{7DF15DF6-C475-4866-9111-F5150C1336E1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -23,6 +25,10 @@ Global
{DB96EFB4-FA45-4ACC-8D51-7ED37065CC79}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB96EFB4-FA45-4ACC-8D51-7ED37065CC79}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB96EFB4-FA45-4ACC-8D51-7ED37065CC79}.Release|Any CPU.Build.0 = Release|Any CPU
{671CB9E5-3EFD-4466-935E-1BF58470296F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{671CB9E5-3EFD-4466-935E-1BF58470296F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{671CB9E5-3EFD-4466-935E-1BF58470296F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{671CB9E5-3EFD-4466-935E-1BF58470296F}.Release|Any CPU.Build.0 = Release|Any CPU
{7DF15DF6-C475-4866-9111-F5150C1336E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7DF15DF6-C475-4866-9111-F5150C1336E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7DF15DF6-C475-4866-9111-F5150C1336E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
// 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("SampleWebServerExtension")]
[assembly: AssemblyTitle("SampleCityWebMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SampleWebServerExtension")]
[assembly: AssemblyProduct("SampleCityWebMod")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand All @@ -19,7 +19,7 @@
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4f860aa2-80ae-427e-b9ea-b31b40d67d8a")]
[assembly: Guid("f256642a-950b-4950-a608-ce6891954c29")]

// Version information for an assembly consists of the following four values:
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<ProjectGuid>{7DF15DF6-C475-4866-9111-F5150C1336E1}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SampleWebServerExtension</RootNamespace>
<AssemblyName>SampleWebServerExtension</AssemblyName>
<RootNamespace>SampleCityWebMod</RootNamespace>
<AssemblyName>SampleCityWebMod</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using CityWebServer.Extensibility;
using JetBrains.Annotations;

namespace SampleWebServerExtension
namespace SampleCityWebMod
{
[UsedImplicitly]
public class SampleRequestHandler : RequestHandlerBase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,28 @@
using ICities;
using CityWebServer.Extensibility;

namespace SampleWebServerExtension
namespace SampleCityWebMod
{
public class UserModInfo : IUserMod, ICityWebMod
{
public String Name
{
get { return "Sample Web Server Extension"; }
get { return "CityWebServer - Sample CityWebMod"; }
}

public String ModName
{
get { return "Sample Extension"; }
get { return "Sample CWM"; }
}

public String ModAuthor
{
get { return "Rychard"; }
get { return "nezroy"; }
}

public String ModID
{
get { return "sample"; }
get { return "samplecwm"; }
}

public String Description
Expand Down
34 changes: 34 additions & 0 deletions SampleNakedHandlerMod/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System.Reflection;
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("SampleNakedHandlerMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SampleNakedHandlerMod")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[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("5ae91567-7726-4730-a8a1-8bebf725b9a0")]

// 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 Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
73 changes: 73 additions & 0 deletions SampleNakedHandlerMod/SampleNakedHandlerMod.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{671CB9E5-3EFD-4466-935E-1BF58470296F}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SampleNakedHandlerMod</RootNamespace>
<AssemblyName>SampleNakedHandlerMod</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICities">
<HintPath>..\ICities.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\UnityEngine.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SampleRequestHandler.cs" />
<Compile Include="UserModInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CityWebServer.Extensibility\CityWebServer.Extensibility.csproj">
<Project>{db96efb4-fa45-4acc-8d51-7ed37065cc79}</Project>
<Name>CityWebServer.Extensibility</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>mkdir "%25LOCALAPPDATA%25\Colossal Order\Cities_Skylines\Addons\Mods\$(SolutionName)_$(ProjectName)"

del "%25LOCALAPPDATA%25\Colossal Order\Cities_Skylines\Addons\Mods\$(SolutionName)_$(ProjectName)\$(TargetFileName)"

xcopy /Y "$(TargetPath)" "%25LOCALAPPDATA%25\Colossal Order\Cities_Skylines\Addons\Mods\$(SolutionName)_$(ProjectName)"</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
23 changes: 23 additions & 0 deletions SampleNakedHandlerMod/SampleRequestHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Net;
using CityWebServer.Extensibility;
using JetBrains.Annotations;

namespace SampleNakedHandlerMod
{
[UsedImplicitly]
public class SampleRequestHandler : RequestHandlerBase
{
public SampleRequestHandler(IWebServer server)
: base(server, "Sample Naked Handler", "Rychard", 100, "/samplenaked")
{
}

public override IResponseFormatter Handle(HttpListenerRequest request, String slug, String wwwroot)
{
const String content = "This is a sample page!";

return HtmlResponse(content);
}
}
}
19 changes: 19 additions & 0 deletions SampleNakedHandlerMod/UserModInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using ICities;

namespace SampleNakedHandlerMod
{
public class UserModInfo : IUserMod
{
public String Name
{
get { return "CityWebServer - Sample Naked Handler Mod"; }
}

public String Description
{
get { return "Adds a sample page to the integrated web server. Doesn't do anything without it!"; }
}
}
}

0 comments on commit de87d97

Please sign in to comment.