-
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
Showing
13 changed files
with
501 additions
and
25 deletions.
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
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,60 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
namespace GCManager | ||
{ | ||
public class Profile | ||
{ | ||
public class ProfileEntry | ||
{ | ||
public string fullName; | ||
public string version; | ||
|
||
public ProfileEntry() | ||
{ | ||
|
||
} | ||
|
||
public ProfileEntry(Mod mod) | ||
{ | ||
this.fullName = mod.fullName; | ||
this.version = mod.version; | ||
} | ||
} | ||
|
||
public string name; | ||
|
||
public List<ProfileEntry> entries = new List<ProfileEntry>(); | ||
|
||
public void Install(ModList onlineMods, bool installProfileVersions) | ||
{ | ||
foreach (ProfileEntry entry in entries) | ||
{ | ||
Mod mod = onlineMods.Find(entry.fullName); | ||
|
||
if (mod != null) | ||
{ | ||
ModManager.ActivateMod(mod, installProfileVersions ? entry.version : null); | ||
} | ||
else | ||
MessageBox.Show("Could not find mod \"" + entry.fullName + "\"!", "Profile Load Error", MessageBoxButton.OK); | ||
} | ||
} | ||
|
||
public void Add(Mod localMod) | ||
{ | ||
entries.Add(new ProfileEntry(localMod)); | ||
} | ||
|
||
public void Save() | ||
{ | ||
File.WriteAllText(Path.Combine(ManagerInfo.Get().GetFullProfileDirectory(), (name + ".json")), JsonConvert.SerializeObject(this)); | ||
} | ||
} | ||
} |
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,16 @@ | ||
<Window x:Class="GCManager.ProfileCreateWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:GCManager" | ||
mc:Ignorable="d" | ||
Title="New Profile" Height="130" Width="300" ResizeMode="NoResize"> | ||
<Grid> | ||
<TextBlock HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="New Profile Name" VerticalAlignment="Top"/> | ||
<TextBox Height="23" Margin="10,30,10,0" TextWrapping="Wrap" Text="{Binding profileName, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Top"/> | ||
<Button Content="Create Profile" HorizontalAlignment="Right" Margin="0,0,10,10" VerticalAlignment="Bottom" Width="75" IsDefault="True" Click="Create_Click"/> | ||
<Button Content="Cancel" HorizontalAlignment="Left" Margin="10,0,0,10" VerticalAlignment="Bottom" Width="75" IsCancel="True" Click="Cancel_Click"/> | ||
|
||
</Grid> | ||
</Window> |
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,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Shapes; | ||
|
||
namespace GCManager | ||
{ | ||
|
||
public partial class ProfileCreateWindow : Window | ||
{ | ||
public string profileName { get; set; } | ||
|
||
public ProfileCreateWindow() | ||
{ | ||
InitializeComponent(); | ||
|
||
this.DataContext = this; | ||
} | ||
|
||
private void Cancel_Click(object sender, RoutedEventArgs e) | ||
{ | ||
this.DialogResult = false; | ||
} | ||
|
||
private void Create_Click(object sender, RoutedEventArgs e) | ||
{ | ||
this.DialogResult = true; | ||
} | ||
} | ||
} |
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 @@ | ||
<Window x:Class="GCManager.ProfileLoadWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:GCManager" | ||
mc:Ignorable="d" | ||
Title="Load Profile" Height="130" Width="300" ResizeMode="NoResize"> | ||
<Grid> | ||
<Button Content="Load" HorizontalAlignment="Right" Margin="0,0,10,10" VerticalAlignment="Bottom" Width="75" IsDefault="True" Click="Load_Click"/> | ||
<Button Content="Cancel" HorizontalAlignment="Left" Margin="10,0,0,10" VerticalAlignment="Bottom" Width="75" IsCancel="True" Click="Cancel_Click"/> | ||
<CheckBox IsChecked="{Binding installOverExisting}" Content="Do not uninstall existing mods before load" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top"/> | ||
<CheckBox IsChecked="{Binding installProfileVersions}" Content="Install versions specified in profile" HorizontalAlignment="Left" Margin="10,30,0,0" VerticalAlignment="Top"/> | ||
<TextBlock HorizontalAlignment="Left" Margin="38,45,0,0" TextWrapping="Wrap" Text="(Otherwise, latest versions will be used)" VerticalAlignment="Top" FontSize="11" Foreground="#FF979797"/> | ||
|
||
</Grid> | ||
</Window> |
Oops, something went wrong.