-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da39423
commit d8002f3
Showing
12 changed files
with
489 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* SporeModLoader - https://github.com/Rosalie241/SporeModLoader | ||
* Copyright (C) 2022 Rosalie Wanders <rosalie@mailbox.org> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 3. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using System.IO; | ||
using System.Xml.Serialization; | ||
|
||
namespace SporeModManager.SporeMods.Xml | ||
{ | ||
public class DirectoryConfig | ||
{ | ||
public string ModLibsDirectory { get; set; } | ||
public string GalacticAdventuresDataDirectory { get; set; } | ||
public string CoreSporeDataDirectory { get; set; } | ||
|
||
public static DirectoryConfig ReadFromXml() | ||
{ | ||
var directoryConfig = new DirectoryConfig(); | ||
|
||
if (File.Exists("DirectoryConfig.xml")) | ||
{ | ||
using (var fileStream = File.OpenRead("DirectoryConfig.xml")) | ||
{ | ||
var xmlSerializer = new XmlSerializer(typeof(DirectoryConfig)); | ||
directoryConfig = (DirectoryConfig)xmlSerializer.Deserialize(fileStream); | ||
fileStream.Close(); | ||
} | ||
} | ||
else | ||
{ | ||
directoryConfig.ModLibsDirectory = @"..\ModLibs"; | ||
directoryConfig.GalacticAdventuresDataDirectory = @"..\..\DataEP1"; | ||
directoryConfig.CoreSporeDataDirectory = @"..\..\Data"; | ||
|
||
using (var textWriter = new StreamWriter("DirectoryConfig.xml")) | ||
{ | ||
var serializer = new XmlSerializer(typeof(DirectoryConfig)); | ||
serializer.Serialize(textWriter, directoryConfig); | ||
} | ||
} | ||
|
||
return directoryConfig; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* SporeModLoader - https://github.com/Rosalie241/SporeModLoader | ||
* Copyright (C) 2022 Rosalie Wanders <rosalie@mailbox.org> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 3. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using System.Collections.Generic; | ||
|
||
namespace SporeModManager.SporeMods.Xml | ||
{ | ||
public class InstalledMod | ||
{ | ||
public string Name { get; set; } | ||
public string UniqueName { get; set; } | ||
public string Description { get; set; } | ||
public List<InstalledModFile> Files { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* SporeModLoader - https://github.com/Rosalie241/SporeModLoader | ||
* Copyright (C) 2022 Rosalie Wanders <rosalie@mailbox.org> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 3. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
namespace SporeModManager.SporeMods.Xml | ||
{ | ||
public class InstalledModFile | ||
{ | ||
public string FileName { get; set; } | ||
public ModInfoInstallLocation InstallLocation { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* SporeModLoader - https://github.com/Rosalie241/SporeModLoader | ||
* Copyright (C) 2022 Rosalie Wanders <rosalie@mailbox.org> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 3. | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Xml.Serialization; | ||
|
||
namespace SporeModManager.SporeMods.Xml | ||
{ | ||
public class InstalledMods | ||
{ | ||
public List<InstalledMod> InstalledModList { get; set; } | ||
|
||
public static InstalledMods ReadFromXml() | ||
{ | ||
var installedMods = new InstalledMods(); | ||
|
||
if (File.Exists("InstalledMods.xml")) | ||
{ | ||
using (var fileStream = File.OpenRead("InstalledMods.xml")) | ||
{ | ||
var xmlSerializer = new XmlSerializer(typeof(InstalledMods)); | ||
installedMods = (InstalledMods)xmlSerializer.Deserialize(fileStream); | ||
} | ||
} | ||
else | ||
{ | ||
installedMods.InstalledModList = new List<InstalledMod>(); | ||
} | ||
|
||
return installedMods; | ||
} | ||
|
||
public static void SaveToXml(InstalledMods installedMods) | ||
{ | ||
using (var textWriter = new StreamWriter("InstalledMods.xml")) | ||
{ | ||
var serializer = new XmlSerializer(typeof(InstalledMods)); | ||
serializer.Serialize(textWriter, installedMods); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.