Skip to content
This repository has been archived by the owner on Mar 27, 2023. It is now read-only.

Commit

Permalink
Add files
Browse files Browse the repository at this point in the history
  • Loading branch information
duniul committed Apr 14, 2020
1 parent 15af999 commit 23c916b
Show file tree
Hide file tree
Showing 4 changed files with 186 additions and 0 deletions.
42 changes: 42 additions & 0 deletions Main.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System.IO;
using System.Reflection;
using TaleWorlds.CampaignSystem;
using TaleWorlds.Core;
using TaleWorlds.MountAndBlade;

namespace WandererStringsLoader
{
public class Main : MBSubModuleBase
{
private string[] FindWandererStringsXMLs()
{
string assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string currentModuleDir = Path.Combine(assemblyDir, "..", "..");
string moduleDataDir = Path.Combine(currentModuleDir, "ModuleData");
string[] wandererXMLFiles = Directory.GetFiles(moduleDataDir, "wanderer_strings*.xml");
return wandererXMLFiles;
}

private void LoadWandererStringsXMLs(CampaignGameStarter gameInitializer)
{
string[] wandererXMLFiles = this.FindWandererStringsXMLs();

foreach (string filePath in wandererXMLFiles)
{
gameInitializer.LoadGameTexts(filePath);
}
}

public override void OnGameLoaded(Game game, object initializerObject)
{
CampaignGameStarter gameInitializer = (CampaignGameStarter)initializerObject;
this.LoadWandererStringsXMLs(gameInitializer);
}

public override void OnNewGameCreated(Game game, object initializerObject)
{
CampaignGameStarter gameInitializer = (CampaignGameStarter)initializerObject;
this.LoadWandererStringsXMLs(gameInitializer);
}
}
}
36 changes: 36 additions & 0 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
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("WandererStringsLoader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WandererStringsLoader")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[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("e94b1808-c5d9-4bf2-9858-f83286e18504")]

// 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.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
77 changes: 77 additions & 0 deletions WandererStringsLoader.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<Project 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')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E94B1808-C5D9-4BF2-9858-F83286E18504}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WandererStringsLoader</RootNamespace>
<AssemblyName>WandererStringsLoader</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</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>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="TaleWorlds.CampaignSystem">
<HintPath>..\..\..\..\..\Games\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.CampaignSystem.dll</HintPath>
</Reference>
<Reference Include="TaleWorlds.Core">
<HintPath>..\..\..\..\..\Games\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.Core.dll</HintPath>
</Reference>
<Reference Include="TaleWorlds.MountAndBlade">
<HintPath>..\..\..\..\..\Games\Steam\steamapps\common\Mount &amp; Blade II Bannerlord\bin\Win64_Shipping_Client\TaleWorlds.MountAndBlade.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
31 changes: 31 additions & 0 deletions WandererStringsLoader.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WandererStringsLoader", "WandererStringsLoader.csproj", "{E94B1808-C5D9-4BF2-9858-F83286E18504}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E94B1808-C5D9-4BF2-9858-F83286E18504}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E94B1808-C5D9-4BF2-9858-F83286E18504}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E94B1808-C5D9-4BF2-9858-F83286E18504}.Debug|x64.ActiveCfg = Debug|x64
{E94B1808-C5D9-4BF2-9858-F83286E18504}.Debug|x64.Build.0 = Debug|x64
{E94B1808-C5D9-4BF2-9858-F83286E18504}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E94B1808-C5D9-4BF2-9858-F83286E18504}.Release|Any CPU.Build.0 = Release|Any CPU
{E94B1808-C5D9-4BF2-9858-F83286E18504}.Release|x64.ActiveCfg = Release|x64
{E94B1808-C5D9-4BF2-9858-F83286E18504}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {11E6DA27-B769-4DC6-90A2-AB923BFBA0FE}
EndGlobalSection
EndGlobal

0 comments on commit 23c916b

Please sign in to comment.