Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions build-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

# Configuration
REAL_GAME_DIR="/var/mnt/schijven/1TB SSD/Games/Cities - Skylines/drive_c/Program Files (x86)/Cities.Skylines.v1.21.1.F5"
MANAGED_DIR="$REAL_GAME_DIR/Cities_Data/Managed"
MODS_DIR="$REAL_GAME_DIR/Files/Mods"
CSM_ASSEMBLIES="/home/king/CS1 Mods/CSM/assemblies"

# Harmony Assembly Paths
HARMONY_CORE="$MODS_DIR/Harmony 2.2.2-0/CitiesHarmony.Harmony.dll"
HARMONY_API="$MODS_DIR/81 Tiles 2 1.0.5/CitiesHarmony.API.dll"
PROTOBUF="$CSM_ASSEMBLIES/protobuf-net.dll"

echo "=== Building CSM (Linux) ==="

# Build command using dotnet msbuild properties to pass paths
dotnet build src/csm/CSM.csproj -c Release \
-p:ManagedDir="$MANAGED_DIR" \
-p:CsmDir="$CSM_ASSEMBLIES" \
-p:HarmonyDll="$HARMONY_CORE" \
-p:HarmonyApiDll="$HARMONY_API"

if [ $? -eq 0 ]; then
echo "=== Build Successful! ==="

# Optional: Install to game directory
TARGET_MOD_DIR="$MODS_DIR/CSM_Built"
echo "Installing to: $TARGET_MOD_DIR"
mkdir -p "$TARGET_MOD_DIR"
cp src/csm/bin/Release/net35/CSM.dll "$TARGET_MOD_DIR/"
cp src/api/bin/Release/net35/CSM.API.dll "$TARGET_MOD_DIR/"
cp src/basegame/bin/Release/net35/CSM.BaseGame.dll "$TARGET_MOD_DIR/"
# Copy dependencies
cp "$CSM_ASSEMBLIES"/*.dll "$TARGET_MOD_DIR/"

echo "Done."
else
echo "=== Build Failed! ==="
exit 1
fi
83 changes: 32 additions & 51 deletions src/api/CSM.API.csproj
Original file line number Diff line number Diff line change
@@ -1,64 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{AB27EACD-B9A9-42BC-BF8A-3B25AABFF6CA}</ProjectGuid>
<TargetFramework>net35</TargetFramework>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CSM.API</RootNamespace>
<AssemblyName>CSM.API</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<EnableDefaultCompileItems>true</EnableDefaultCompileItems>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<LangVersion>7.3</LangVersion>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<Deterministic>false</Deterministic>
</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="System" />
<Reference Include="System.Core" />
</ItemGroup>

<ItemGroup>
<Compile Include="Chat.cs" />
<Compile Include="Commands\Command.cs" />
<Compile Include="Commands\CommandBase.cs" />
<Compile Include="Commands\CommandHandler.cs" />
<Compile Include="Connection.cs" />
<Compile Include="Helpers\IgnoreHelper.cs" />
<Compile Include="Helpers\ReflectionHelper.cs" />
<Compile Include="Log.cs" />
<Compile Include="Networking\Player.cs" />
<Compile Include="Networking\Status\ClientStatus.cs" />
<Compile Include="Networking\Status\ServerStatus.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Reference Include="Assembly-CSharp"><HintPath>$(ManagedDir)\Assembly-CSharp.dll</HintPath><Private>false</Private></Reference>
<Reference Include="ColossalManaged"><HintPath>$(ManagedDir)\ColossalManaged.dll</HintPath><Private>false</Private></Reference>
<Reference Include="ICities"><HintPath>$(ManagedDir)\ICities.dll</HintPath><Private>false</Private></Reference>
<Reference Include="UnityEngine"><HintPath>$(ManagedDir)\UnityEngine.dll</HintPath><Private>false</Private></Reference>
<Reference Include="UnityEngine.UI"><HintPath>$(ManagedDir)\UnityEngine.UI.dll</HintPath><Private>false</Private></Reference>
<Reference Include="protobuf-net"><HintPath>$(CsmDir)\protobuf-net.dll</HintPath><Private>false</Private></Reference>
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Threading.dll">
<Version>1.0.2856.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.net35" Version="1.0.3" PrivateAssets="all" />
</ItemGroup>

<PropertyGroup>
<Net35RefDir>$(PkgMicrosoft_NETFramework_ReferenceAssemblies_net35)build\.NETFramework\v3.5</Net35RefDir>
</PropertyGroup>

<ItemGroup>
<Reference Include="protobuf-net">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\assemblies\protobuf-net.dll</HintPath>
<Reference Include="mscorlib">
<HintPath>$(Net35RefDir)\mscorlib.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="System">
<HintPath>$(Net35RefDir)\System.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="System.Core">
<HintPath>$(Net35RefDir)\System.Core.dll</HintPath>
<Private>false</Private>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
16 changes: 12 additions & 4 deletions src/api/Helpers/IgnoreHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,22 @@ namespace CSM.API.Helpers
/// </summary>
public class IgnoreHelper
{
[ThreadStatic]
private static IgnoreHelper _instance;

public static IgnoreHelper Instance
{
get => _instance.Value;
set => _instance.Value = value;
get
{
if (_instance == null)
{
_instance = new IgnoreHelper();
}
return _instance;
}
set => _instance = value;
}

private static readonly ThreadLocal<IgnoreHelper> _instance = new ThreadLocal<IgnoreHelper>(() => new IgnoreHelper());

private int _ignoreAll = 0;
private readonly HashSet<string> _exceptions = new HashSet<string>();

Expand Down
Loading