C
C#5mo ago
Austin9675

Finding a game file

I am making a UI for setting up a dedicated server for a game on steam, the problem im having is that the program can find the directory that the file is in but it cannot find the file it needs to write to, its a configuration file if that matters at all, so im basically wondering if theres anything special i need to do
1 Reply
Austin9675
Austin96755mo ago
private void step2Button_Click(object sender, EventArgs e) { string userHomePath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); string palServerRelativePath = Path.Combine("Program Files (x86)", "Steam", "steamapps", "common", "PalServer", "Pal", "Saved", "Config", "WindowsServer"); string palServerConfigPath = Path.Combine(userHomePath, palServerRelativePath); string fileName = "PalWorldSettings.config"; string filePath = Path.Combine(palServerConfigPath, fileName); if (!Directory.Exists(palServerConfigPath)) { Console.WriteLine($"Directory not found: {palServerConfigPath}"); }
if (File.Exists(filePath)) { using (StreamWriter sw = new StreamWriter(palServerConfigPath)) { sw.WriteLine("[/Script/Pal.PalGameWorldSettings]"); sw.WriteLine("OptionSettings=(Difficulty=None,DayTimeSpeedRate=1.000000,NightTimeSpeedRate=1.000000,ExpRate=1.000000,PalCaptureRate=1.000000,PalSpawnNumRate=1.000000,PalDamageRateAttack=1.000000,PalDamageRateDefense=1.000000,PlayerDamageRateAttack=1.000000,PlayerDamageRateDefense=1.000000,PlayerStomachDecreaceRate=1.000000,PlayerStaminaDecreaceRate=1.000000,PlayerAutoHPRegeneRate=1.000000,PlayerAutoHpRegeneRateInSleep=1.000000,PalStomachDecreaceRate=1.000000,PalStaminaDecreaceRate=1.000000,PalAutoHPRegeneRate=1.000000,PalAutoHpRegeneRateInSleep=1.000000,BuildObjectDamageRate=1.000000,BuildObjectDeteriorationDamageRate=1.000000,CollectionDropRate=1.000000,CollectionObjectHpRate=1.000000,CollectionObjectRespawnSpeedRate=1.000000,EnemyDropItemRate=1.000000,DeathPenalty=All,bEnablePlayerToPlayerDamage=False,bEnableFriendlyFire=False,bEnableInvaderEnemy=True,bActiveUNKO=False,bEnableAimAssistPad=True,bEnableAimAssistKeyboard=False,DropItemMaxNum=3000,DropItemMaxNum_UNKO=100,BaseCampMaxNum=128,BaseCampWorkerMaxNum=15,DropItemAli"); sw.WriteLine(@"veMaxHours=1.000000,bAutoResetGuildNoOnlinePlayers=False,AutoResetGuildTimeNoOnlinePlayers=72.000000,GuildPlayerMaxNum=20,PalEggDefaultHatchingTime=72.000000,WorkSpeedRate=1.000000,bIsMultiplay=False,bIsPvP=False,bCanPickupOtherGuildDeathPenaltyDrop=False,bEnableNonLoginPenalty=True,bEnableFastTravel=True,bIsStartLocationSelectByMap=True,bExistPlayerAfterLogout=False,bEnableDefenseOtherGuildPlayer=False,CoopPlayerMaxNum=4,ServerPlayerMaxNum=32,ServerName=""Default Palworld Server"",ServerDescription="""",AdminPassword="""",ServerPassword="""",PublicPort=8211,PublicIP="""",RCONEnabled=False,RCONPort=25575,Region="""",bUseAuth=True,BanListURL=""https://api.palworldgame.com/api/banlist.txt"""); } } else { MessageBox.Show($"{fileName} cannot be found, you must download PalWorld Dedicated Servers on steam!", "File not found"); } }