Skip to content

Commit

Permalink
switch to .fantome
Browse files Browse the repository at this point in the history
  • Loading branch information
moonshadow565 committed Jan 4, 2021
1 parent 8580134 commit 2c36cc1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Fantome/MVVM/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public async Task AddMod()
Multiselect = false
};

dialog.Filters.Add(new CommonFileDialogFilter("ZIP Files", "*.zip"));
dialog.Filters.Add(new CommonFileDialogFilter("Fantome mod Files", "*.fantome;*.zip"));

if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
{
Expand All @@ -166,7 +166,7 @@ public async Task AddMod(string modOriginalPath)
{
using (ModFile originalMod = new ModFile(modOriginalPath))
{
modPath = string.Format(@"{0}\{1}.zip", ModManager.MOD_FOLDER, originalMod.GetID());
modPath = string.Format(@"{0}\{1}.fantome", ModManager.MOD_FOLDER, originalMod.GetID());
}
}
catch (Exception exception)
Expand Down
2 changes: 1 addition & 1 deletion Fantome/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private async void OnDrop(object sender, System.Windows.DragEventArgs e)
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
for (int i = 0; i < files.Length; i++)
{
if (Path.GetExtension(files[i]) == ".zip")
if (Path.GetExtension(files[i]) == ".zip" || Path.GetExtension(files[i]) == ".fantome")
{
await this.ViewModel.AddMod(files[i]);
}
Expand Down
4 changes: 2 additions & 2 deletions Fantome/ModManagement/IO/ModFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public ModFile(string fileLocation)
}
public ModFile(LeagueFileIndex index, IEnumerable<string> wadFilePaths, IEnumerable<string> wadFolderPaths, ModInfo info, Image image)
{
using (FileStream fileStream = new FileStream(string.Format(@"{0}\{1}.zip", ModManager.MOD_FOLDER, info.CreateID()), FileMode.Create))
using (FileStream fileStream = new FileStream(string.Format(@"{0}\{1}.fantome", ModManager.MOD_FOLDER, info.CreateID()), FileMode.Create))
{
using (this.Content = new ZipArchive(fileStream, ZipArchiveMode.Update))
{
Expand Down Expand Up @@ -100,7 +100,7 @@ public ModFile(LeagueFileIndex index, IEnumerable<string> wadFilePaths, IEnumera
}
}

this.Content = ZipFile.OpenRead(string.Format(@"{0}\{1}.zip", ModManager.MOD_FOLDER, this.GetID()));
this.Content = ZipFile.OpenRead(string.Format(@"{0}\{1}.fantome", ModManager.MOD_FOLDER, this.GetID()));
}

public void AddFolder(string path, string folderLocation)
Expand Down
2 changes: 1 addition & 1 deletion Fantome/ModManagement/ModDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void MountMods()
{
foreach (var mod in this.Mods)
{
string modPath = Path.Combine(ModManager.MOD_FOLDER, mod.Key + ".zip");
string modPath = Path.Combine(ModManager.MOD_FOLDER, mod.Key + ".fantome");
if(File.Exists(modPath))
{
try
Expand Down
4 changes: 2 additions & 2 deletions Fantome/ModManagement/ModManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public void RemoveMod(ModFile mod)

mod.Content.Dispose();
this.Database.RemoveMod(modId);
File.Delete(string.Format(@"{0}\{1}.zip", MOD_FOLDER, modId));
File.Delete(string.Format(@"{0}\{1}.fantome", MOD_FOLDER, modId));
}

public void InstallMod(ModFile mod)
Expand Down Expand Up @@ -351,7 +351,7 @@ public void SyncWithModFolder()
foreach (KeyValuePair<string, bool> mod in this.Database.Mods)
{
//Remove mods which are not present in the Mods folder anymore
string modPath = string.Format(@"{0}\{1}.zip", MOD_FOLDER, mod.Key);
string modPath = string.Format(@"{0}\{1}.fantome", MOD_FOLDER, mod.Key);
if (!File.Exists(modPath))
{
this.Database.RemoveMod(mod.Key);
Expand Down

0 comments on commit 2c36cc1

Please sign in to comment.