diff --git a/.gitignore b/.gitignore index e02fc88..e1d9979 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,2 @@ -.vdf -DLLSourceCode/**/*.dll -DLLSourceCode/bin/* -DLLSourceCode/obj/* -DLLSourceCode/References/* +Defs/ +Sounds/ \ No newline at end of file diff --git a/About/PublishedFileId.txt b/About/PublishedFileId.txt deleted file mode 100644 index d7c8706..0000000 --- a/About/PublishedFileId.txt +++ /dev/null @@ -1 +0,0 @@ -3523549667 \ No newline at end of file diff --git a/Assemblies/AddMyMusicMod.dll b/Assemblies/AddMyMusicMod.dll deleted file mode 100644 index 196d26b..0000000 Binary files a/Assemblies/AddMyMusicMod.dll and /dev/null differ diff --git a/DLLSourceCode/AddMyMusicMod.csproj b/DLLSourceCode/AddMyMusicMod.csproj deleted file mode 100644 index da95c02..0000000 --- a/DLLSourceCode/AddMyMusicMod.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - 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 deleted file mode 100644 index e084ba9..0000000 --- a/DLLSourceCode/test.cs +++ /dev/null @@ -1,88 +0,0 @@ -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/add_my_music.bat b/add_my_music.bat index 5fb7cca..fca4634 100644 --- a/add_my_music.bat +++ b/add_my_music.bat @@ -3,47 +3,44 @@ echo This command will completely overwrite the Songs_Gameplay.xml file of this pause setlocal enabledelayedexpansion +set "Songs_Gameplay_XML_path=Defs\SongDefs" -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%" +set "music_path=Sounds\Gameplay" chcp 65001 -echo ^ > "%mod_user_dir%\Songs_Gameplay.xml" -echo ^ >> "%mod_user_dir%\Songs_Gameplay.xml" +echo ^ > "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" +echo ^ >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" -for %%f in ("%music_database%\*") do ( +for %%f in ("%music_path%\*") do ( set sound_name=%%~nf - 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 ^ >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo ^!sound_name!^ >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo ^Gameplay/!sound_name!^ >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo. >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo ^<^^!--The probability of music appearing in the game--^> >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo ^1.0^ >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo. >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo ^<^^!--Music volume--^> >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo ^1.0^ >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo. >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo ^<^^!--If true, it only plays in a combat situation--^> >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo ^false^ >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo. >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo ^<^^!--If you want to limit the time of day, delete '^<^^!- -' and '- -^>' of the desired option--^> >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo ^<^^!--^Day^--^> >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo ^<^^!--^Night^--^> >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo. >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo ^<^^!--Listing the seasons in which this song is played--^> >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo ^ ^Winter^^Spring^^Summer^^Fall^ ^ >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" - echo ^ >> "%mod_user_dir%\Songs_Gameplay.xml" - echo. >> "%mod_user_dir%\Songs_Gameplay.xml" + echo ^ >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo. >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" + echo Added !sound_name! ) -echo ^ >> "%mod_user_dir%\Songs_Gameplay.xml" +echo ^ >> "%Songs_Gameplay_XML_path%\Songs_Gameplay.xml" echo Songs_Gameplay.xml overwritten. After restarting the game, music will be added. pause \ No newline at end of file