diff --git a/.gitignore b/.gitignore
index e69de29..e02fc88 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,5 @@
+.vdf
+DLLSourceCode/**/*.dll
+DLLSourceCode/bin/*
+DLLSourceCode/obj/*
+DLLSourceCode/References/*
diff --git a/About/About.xml b/About/About.xml
index 8d44fd9..6712b52 100644
--- a/About/About.xml
+++ b/About/About.xml
@@ -7,6 +7,10 @@
1.5
1.6
+
+ ludeon.rimworld
+ brrainz.harmony
+
[EN]
This mod adds the ability to put your own music in the game.
diff --git a/Assemblies/AddMyMusicMod.dll b/Assemblies/AddMyMusicMod.dll
new file mode 100644
index 0000000..196d26b
Binary files /dev/null and b/Assemblies/AddMyMusicMod.dll differ
diff --git a/DLLSourceCode/AddMyMusicMod.csproj b/DLLSourceCode/AddMyMusicMod.csproj
new file mode 100644
index 0000000..da95c02
--- /dev/null
+++ b/DLLSourceCode/AddMyMusicMod.csproj
@@ -0,0 +1,24 @@
+
+
+ netstandard2.1
+
+
+
+
+ References/0Harmony.dll
+
+
+ References/Assembly-CSharp.dll
+
+
+ References/UnityEngine.dll
+
+
+ References/UnityEngine.CoreModule.dll
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DLLSourceCode/test.cs b/DLLSourceCode/test.cs
new file mode 100644
index 0000000..e084ba9
--- /dev/null
+++ b/DLLSourceCode/test.cs
@@ -0,0 +1,88 @@
+using System;
+using System.IO;
+using System.Diagnostics;
+using Verse;
+
+[StaticConstructorOnStartup]
+public static class CopyDefsAtStartup
+{
+ static CopyDefsAtStartup()
+ {
+ try
+ {
+
+ string localPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
+ string localLowPath = Path.Combine(Path.GetDirectoryName(localPath), "LocalLow");
+
+ string songsGameplayXMLSourcePath = Path.Combine(localLowPath, @"Ludeon Studios\RimWorld by Ludeon Studios\AddMyMusic_data\Songs_Gameplay.xml");
+ string songsDBSourcePath = Path.Combine(localLowPath, @"Ludeon Studios\RimWorld by Ludeon Studios\AddMyMusic_data\music_is_here");
+
+ string modDefsDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Mods", "custom_music", "Defs", "SongDefs");
+ string modSoundsDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Mods", "custom_music", "Sounds", "Gameplay");
+
+ if (!Directory.Exists(modDefsDir))
+ Directory.CreateDirectory(modDefsDir);
+
+ string modDefsPath = Path.Combine(modDefsDir, "Songs_Gameplay.xml");
+
+
+ if (File.Exists(songsGameplayXMLSourcePath))
+ {
+ bool symlinkCreated = SymlinkHelper.CreateDirectorySymlink(modSoundsDir, songsDBSourcePath);
+ File.Copy(songsGameplayXMLSourcePath, modDefsPath, true);
+ Log.Message("[MyMod] Songs_Gameplay.xml скопирован в папку мода.");
+ }
+ else
+ {
+ Log.Warning("[MyMod] Исходный файл Songs_Gameplay.xml не найден.");
+ }
+
+ }
+ catch (Exception e)
+ {
+ Log.Error("[MyMod] Ошибка при копировании Songs_Gameplay.xml: " + e);
+ }
+ }
+}
+
+public static class SymlinkHelper
+{
+ public static bool CreateDirectorySymlink(string linkPath, string targetPath)
+ {
+ try
+ {
+ var psi = new ProcessStartInfo("cmd.exe", $"mklink /D \"{linkPath}\" \"{targetPath}\"")
+ {
+ FileName = "cmd.exe",
+ Arguments = $"/c mklink /D \"{linkPath}\" \"{targetPath}\"",
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ UseShellExecute = false,
+ CreateNoWindow = true,
+ Verb = "runas"
+ };
+
+ using var process = Process.Start(psi);
+ process.WaitForExit();
+
+ string output = process.StandardOutput.ReadToEnd();
+ string error = process.StandardError.ReadToEnd();
+
+ if (process.ExitCode == 0)
+ {
+ Log.Message($"Symlink создан: {output}");
+ return true;
+ }
+ else
+ {
+ Log.Error($"Ошибка создания symlink: {error}");
+ return false;
+ }
+ }
+ catch (Exception e)
+ {
+ Log.Error($"Exception: {e}");
+ return false;
+ }
+ }
+}
diff --git a/Defs/SongDefs/Songs_Gameplay.xml b/Defs/SongDefs/Songs_Gameplay.xml
deleted file mode 100644
index 6a72a1d..0000000
--- a/Defs/SongDefs/Songs_Gameplay.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
- test_music_1
- Gameplay/test_music_1
-
-
- 1.0
-
-
- 1.0
-
-
- false
-
-
- false
-
-
-
-
-
-
- WinterSpringSummerFall
-
-
- test_music_2
- Gameplay/test_music_2
-
-
- 1.0
-
-
- 1.0
-
-
- false
-
-
- false
-
-
-
-
-
-
- WinterSpringSummerFall
-
-
diff --git a/Sounds/Gameplay/test_music_1.mp3 b/Sounds/Gameplay/test_music_1.mp3
deleted file mode 100644
index 9d0804a..0000000
Binary files a/Sounds/Gameplay/test_music_1.mp3 and /dev/null differ
diff --git a/Sounds/Gameplay/test_music_2.ogg b/Sounds/Gameplay/test_music_2.ogg
deleted file mode 100644
index a9271dc..0000000
Binary files a/Sounds/Gameplay/test_music_2.ogg and /dev/null differ
diff --git a/add_my_music.bat b/add_my_music.bat
index cddfef8..5fb7cca 100644
--- a/add_my_music.bat
+++ b/add_my_music.bat
@@ -3,37 +3,47 @@ echo This command will completely overwrite the Songs_Gameplay.xml file of this
pause
setlocal enabledelayedexpansion
-chcp 65001
-echo ^ > Defs\SongDefs\Songs_Gameplay.xml
-echo ^ >> Defs\SongDefs\Songs_Gameplay.xml
-for %%f in (Sounds\Gameplay\*) do (
+set "localappdata=%USERPROFILE%\AppData\LocalLow"
+set "mod_user_dir=%localappdata%\Ludeon Studios\RimWorld by Ludeon Studios\AddMyMusic_data"
+if not exist "%mod_user_dir%" mkdir "%mod_user_dir%"
+
+set "music_database=%mod_user_dir%\music_is_here"
+if not exist "%music_database%" mkdir "%music_database%"
+
+
+chcp 65001
+echo ^ > "%mod_user_dir%\Songs_Gameplay.xml"
+echo ^ >> "%mod_user_dir%\Songs_Gameplay.xml"
+
+for %%f in ("%music_database%\*") do (
set sound_name=%%~nf
- echo ^ >> Defs\SongDefs\Songs_Gameplay.xml
- echo ^!sound_name!^ >> Defs\SongDefs\Songs_Gameplay.xml
- echo ^Gameplay/!sound_name!^ >> Defs\SongDefs\Songs_Gameplay.xml
- echo. >> Defs\SongDefs\Songs_Gameplay.xml
- echo ^<^^!--The probability of music appearing in the game--^> >> Defs\SongDefs\Songs_Gameplay.xml
- echo ^1.0^ >> Defs\SongDefs\Songs_Gameplay.xml
- echo. >> Defs\SongDefs\Songs_Gameplay.xml
- echo ^<^^!--Music volume--^> >> Defs\SongDefs\Songs_Gameplay.xml
- echo ^1.0^ >> Defs\SongDefs\Songs_Gameplay.xml
- echo. >> Defs\SongDefs\Songs_Gameplay.xml
- echo ^<^^!--If true, it only plays in a combat situation--^> >> Defs\SongDefs\Songs_Gameplay.xml
- echo ^false^ >> Defs\SongDefs\Songs_Gameplay.xml
- echo. >> Defs\SongDefs\Songs_Gameplay.xml
- echo ^<^^!--If you want to limit the time of day, delete '^<^^!- -' and '- -^>' of the desired option--^> >> Defs\SongDefs\Songs_Gameplay.xml
- echo ^<^^!--^Day^--^> >> Defs\SongDefs\Songs_Gameplay.xml
- echo ^<^^!--^Night^--^> >> Defs\SongDefs\Songs_Gameplay.xml
- echo. >> Defs\SongDefs\Songs_Gameplay.xml
- echo ^<^^!--Listing the seasons in which this song is played--^> >> Defs\SongDefs\Songs_Gameplay.xml
- echo ^ ^Winter^^Spring^^Summer^^Fall^ ^ >> Defs\SongDefs\Songs_Gameplay.xml
+ echo ^ >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo ^!sound_name!^ >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo ^Gameplay/!sound_name!^ >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo. >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo ^<^^!--The probability of music appearing in the game--^> >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo ^1.0^ >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo. >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo ^<^^!--Music volume--^> >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo ^1.0^ >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo. >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo ^<^^!--If true, it only plays in a combat situation--^> >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo ^false^ >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo. >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo ^<^^!--If you want to limit the time of day, delete '^<^^!- -' and '- -^>' of the desired option--^> >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo ^<^^!--^Day^--^> >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo ^<^^!--^Night^--^> >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo. >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo ^<^^!--Listing the seasons in which this song is played--^> >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo ^ ^Winter^^Spring^^Summer^^Fall^ ^ >> "%mod_user_dir%\Songs_Gameplay.xml"
- echo ^ >> Defs\SongDefs\Songs_Gameplay.xml
+ echo ^ >> "%mod_user_dir%\Songs_Gameplay.xml"
+ echo. >> "%mod_user_dir%\Songs_Gameplay.xml"
)
-echo ^ >> Defs\SongDefs\Songs_Gameplay.xml
+echo ^ >> "%mod_user_dir%\Songs_Gameplay.xml"
echo Songs_Gameplay.xml overwritten. After restarting the game, music will be added.
pause
\ No newline at end of file