コード例 #1
0
        public void GenerateGameModsXml()
        {
            GameMods gameMods = new GameMods();

            gameMods.ConfiguredGameMods = new List <GameMod>();
            gameMods.ConfiguredGameMods.Add(new GameMod
            {
                ModName         = "",
                PathToGameFiles = ""
            });
            gameMods.SaveToFile("config" + SEP + "gamemodstest.xml");
        }
コード例 #2
0
 private static string GetGameFilesPathByGameMod(string gameMod)
 {
     try
     {
         GameMods gameMods          = GameMods.LoadFromFile <GameMods>(@"config" + SEP + "gamemods.xml");
         GameMod  ConfiguredGameMod = gameMods.ConfiguredGameMods.SingleOrDefault(name => name.ModName == gameMod);
         if (Directory.Exists(ConfiguredGameMod.PathToGameFiles))
         {
             if (File.Exists(ConfiguredGameMod.PathToGameFiles + SEP + "7daystodie.exe"))
             {
                 return(ConfiguredGameMod.PathToGameFiles);
             }
         }
         Console.WriteLine("Could not extract GameMods GameFiles Path! Set default!");
         return(SDaysToDiePath);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Could not extract GameMods GameFiles Path! Set default! Exception: " + ex.ToString());
         return(SDaysToDiePath);
     }
 }