-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit b77ec05
Showing
45 changed files
with
3,227 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,34 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.26124.0 | ||
MinimumVisualStudioVersion = 15.0.26124.0 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StellarisModManager", "StellarisModManager\StellarisModManager.csproj", "{96089041-3E1B-49D8-8B69-5713A1B6F9CB}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|Any CPU = Release|Any CPU | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{96089041-3E1B-49D8-8B69-5713A1B6F9CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{96089041-3E1B-49D8-8B69-5713A1B6F9CB}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{96089041-3E1B-49D8-8B69-5713A1B6F9CB}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{96089041-3E1B-49D8-8B69-5713A1B6F9CB}.Debug|x64.Build.0 = Debug|Any CPU | ||
{96089041-3E1B-49D8-8B69-5713A1B6F9CB}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{96089041-3E1B-49D8-8B69-5713A1B6F9CB}.Debug|x86.Build.0 = Debug|Any CPU | ||
{96089041-3E1B-49D8-8B69-5713A1B6F9CB}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{96089041-3E1B-49D8-8B69-5713A1B6F9CB}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{96089041-3E1B-49D8-8B69-5713A1B6F9CB}.Release|x64.ActiveCfg = Release|Any CPU | ||
{96089041-3E1B-49D8-8B69-5713A1B6F9CB}.Release|x64.Build.0 = Release|Any CPU | ||
{96089041-3E1B-49D8-8B69-5713A1B6F9CB}.Release|x86.ActiveCfg = Release|Any CPU | ||
{96089041-3E1B-49D8-8B69-5713A1B6F9CB}.Release|x86.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
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,9 @@ | ||
<Application x:Class="StellarisModManager.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:StellarisModManager" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
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,9 @@ | ||
namespace StellarisModManager | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public sealed partial class App | ||
{ | ||
} | ||
} |
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,10 @@ | ||
using System.Windows; | ||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] |
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,33 @@ | ||
using System; | ||
using System.Windows.Input; | ||
|
||
namespace StellarisModManager | ||
{ | ||
public class Command : ICommand | ||
{ | ||
private readonly Action<object> _action; | ||
private readonly Func<object, bool> _check; | ||
|
||
public event EventHandler CanExecuteChanged | ||
{ | ||
add => CommandManager.RequerySuggested += value; | ||
remove => CommandManager.RequerySuggested -= value; | ||
} | ||
|
||
|
||
public Command(Action<object> action, Func<object, bool> check) | ||
{ | ||
this._action = action; | ||
this._check = check; | ||
} | ||
|
||
public bool CanExecute(object parameter) => this._check?.Invoke(parameter) == true; | ||
|
||
public void Execute(object parameter) => this._action?.Invoke(parameter); | ||
|
||
public void RaiseCanExecuteChanged() | ||
{ | ||
CommandManager.InvalidateRequerySuggested(); | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
StellarisModManager/Configuration/StellarisConfiguration.cs
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,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using StellarisModManager.PDXModLib.Interfaces; | ||
|
||
namespace StellarisModManager.Configuration | ||
{ | ||
public class StellarisConfiguration: IGameConfiguration | ||
{ | ||
public int AppId => 281990; | ||
public string GameName => "Stellaris"; | ||
public string BasePath { get; } | ||
public string ModsDir { get; } | ||
public string SettingsPath { get; } | ||
public string BackupPath { get; } | ||
public string SavedSelections { get; } | ||
public string GameInstallationDirectory { get; } | ||
public IEnumerable<string> WhiteListedFiles { get; } = new[] {"description.txt", "modinfo.lua", "descriptor.mod", "readme.txt", "changelog.txt"}; | ||
|
||
public StellarisConfiguration() | ||
{ | ||
BasePath = $"{Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)}\\Paradox Interactive\\Stellaris"; | ||
//this.BasePath = Path.Combine(Environment.CurrentDirectory, "test"); | ||
this.ModsDir = $"{this.BasePath}\\mod"; | ||
this.SettingsPath = $"{this.BasePath}\\settings.txt"; | ||
this.BackupPath = $"{this.BasePath}\\settings.bak"; | ||
this.SavedSelections = $"{this.BasePath}\\saved_selections.txt"; | ||
} | ||
|
||
public bool SettingsDirectoryValid { get; } = true; | ||
public bool GameDirectoryValid { get; }= 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,42 @@ | ||
using System.Collections.ObjectModel; | ||
|
||
namespace StellarisModManager | ||
{ | ||
|
||
|
||
internal static class Extensions | ||
{ | ||
internal static void MoveItemUp<T>(this ObservableCollection<T> baseCollection, int selectedIndex) | ||
{ | ||
//# Check if move is possible | ||
if (selectedIndex <= 0) | ||
return; | ||
|
||
//# Move-Item | ||
baseCollection.Move(selectedIndex - 1, selectedIndex); | ||
} | ||
|
||
internal static void MoveItemDown<T>(this ObservableCollection<T> baseCollection, int selectedIndex) | ||
{ | ||
//# Check if move is possible | ||
if (selectedIndex < 0 || selectedIndex + 1 >= baseCollection.Count) | ||
return; | ||
|
||
//# Move-Item | ||
baseCollection.Move(selectedIndex + 1, selectedIndex); | ||
} | ||
|
||
internal static void MoveItemDown<T>(this ObservableCollection<T> baseCollection, T selectedItem) | ||
{ | ||
//# MoveDown based on Item | ||
baseCollection.MoveItemDown(baseCollection.IndexOf(selectedItem)); | ||
} | ||
|
||
internal static void MoveItemUp<T>(this ObservableCollection<T> baseCollection, T selectedItem) | ||
{ | ||
//# MoveUp based on Item | ||
baseCollection.MoveItemUp(baseCollection.IndexOf(selectedItem)); | ||
} | ||
|
||
} | ||
} |
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,62 @@ | ||
using System; | ||
using StellarisModManager.PDXModLib.ModData; | ||
|
||
namespace StellarisModManager | ||
{ | ||
using StellarisModManager.Models; | ||
|
||
public sealed class ItemPresenter : Presenter | ||
{ | ||
private static int _ordering; | ||
public Mod Mod { get; } | ||
|
||
public ModsRegistryEntry Entry { get; set; } | ||
public Guid Guid { get; } | ||
public int OriginalSpot { get; } | ||
|
||
private bool _isSelected; | ||
|
||
public string Name => this.Mod.Name; | ||
|
||
private bool _isChecked; | ||
|
||
public bool IsChecked | ||
{ | ||
get => this._isChecked; | ||
set | ||
{ | ||
this._isChecked = value; | ||
this.RaisePropertyChanged(); | ||
} | ||
} | ||
|
||
public bool IsSelected | ||
{ | ||
get => this._isSelected; | ||
set | ||
{ | ||
this._isSelected = value; | ||
this.RaisePropertyChanged(); | ||
} | ||
} | ||
|
||
public ItemPresenter(Mod mod) | ||
{ | ||
this.Mod = mod; | ||
this.Guid = Guid.NewGuid(); | ||
this.OriginalSpot = _ordering++; | ||
} | ||
|
||
public ItemPresenter(Mod mod, string guid) | ||
{ | ||
this.Mod = mod; | ||
this.Guid = Guid.Parse(guid); | ||
this.OriginalSpot = _ordering++; | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return this.Mod.Name; | ||
} | ||
} | ||
} |
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,114 @@ | ||
<Window x:Class="StellarisModManager.MainWindow" | ||
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:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks" | ||
mc:Ignorable="d" | ||
xmlns:dd="urn:gong-wpf-dragdrop" | ||
xmlns:fa="http://schemas.fontawesome.io/icons/" | ||
xmlns:local="clr-namespace:StellarisModManager" | ||
DataContext="{Binding RelativeSource={RelativeSource Self}}" | ||
Title="StellarisModManager" Height="450" Width="800" x:ClassModifier="internal"> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto" /> | ||
<ColumnDefinition Width="*" /> | ||
</Grid.ColumnDefinitions> | ||
<StackPanel Grid.Column="0"> | ||
<Button Name="MoveToTop" HorizontalContentAlignment="Left" Click="MoveToTop_Clicked" ClickMode="Release"> | ||
<StackPanel Orientation="Horizontal"> | ||
<iconPacks:PackIconMaterial Kind="{x:Static iconPacks:PackIconMaterialKind.ChevronDoubleUp}" VerticalAlignment="Center" HorizontalAlignment="Center" /> | ||
<Label>To Top</Label> | ||
</StackPanel> | ||
</Button> | ||
<Button Name="MoveUp" HorizontalContentAlignment="Left" Click="MoveUp_Clicked" ClickMode="Release"> | ||
<StackPanel Orientation="Horizontal"> | ||
<iconPacks:PackIconMaterial Kind="{x:Static iconPacks:PackIconMaterialKind.ChevronUp}" VerticalAlignment="Center" HorizontalAlignment="Center" /> | ||
<Label>Up</Label> | ||
</StackPanel> | ||
</Button> | ||
<Button Name="MoveDown" HorizontalContentAlignment="Left" Click="MoveDown_Clicked" ClickMode="Release"> | ||
<StackPanel Orientation="Horizontal"> | ||
<iconPacks:PackIconMaterial Kind="{x:Static iconPacks:PackIconMaterialKind.ChevronDown}" VerticalAlignment="Center" HorizontalAlignment="Center" /> | ||
<Label>Down</Label> | ||
</StackPanel> | ||
</Button> | ||
<Button Name="MoveToBottom" HorizontalContentAlignment="Left" Click="MoveToBottom_Clicked" ClickMode="Release"> | ||
<StackPanel Orientation="Horizontal"> | ||
<iconPacks:PackIconMaterial Kind="{x:Static iconPacks:PackIconMaterialKind.ChevronDoubleDown}" VerticalAlignment="Center" HorizontalAlignment="Center" /> | ||
<Label>To Bottom</Label> | ||
</StackPanel> | ||
</Button> | ||
<Button Name="Alpha" HorizontalContentAlignment="Left" Click="Alpha_Clicked" ClickMode="Release"> | ||
<StackPanel Orientation="Horizontal"> | ||
<iconPacks:PackIconMaterial Kind="{x:Static iconPacks:PackIconMaterialKind.SortAlphabeticalAscending}" VerticalAlignment="Center" HorizontalAlignment="Center" /> | ||
<Label>Alphabetical</Label> | ||
</StackPanel> | ||
</Button> | ||
<Button Name="Reverse" HorizontalContentAlignment="Left" Click="Reverse_Clicked" ClickMode="Release"> | ||
<StackPanel Orientation="Horizontal"> | ||
<iconPacks:PackIconMaterial Kind="{x:Static iconPacks:PackIconMaterialKind.UndoVariant}" VerticalAlignment="Center" HorizontalAlignment="Center" /> | ||
<Label>Reverse</Label> | ||
</StackPanel> | ||
</Button> | ||
<Button Name="CheckAll" HorizontalContentAlignment="Left" Click="CheckAll_Clicked" ClickMode="Release"> | ||
<StackPanel Orientation="Horizontal"> | ||
<iconPacks:PackIconMaterial Kind="{x:Static iconPacks:PackIconMaterialKind.CheckboxMarked}" VerticalAlignment="Center" HorizontalAlignment="Center" /> | ||
<Label>All</Label> | ||
</StackPanel> | ||
</Button> | ||
<Button Name="UncheckAll" HorizontalContentAlignment="Left" Click="UncheckAll_Clicked" ClickMode="Release"> | ||
<StackPanel Orientation="Horizontal"> | ||
<iconPacks:PackIconMaterial Kind="{x:Static iconPacks:PackIconMaterialKind.CheckboxBlank}" VerticalAlignment="Center" HorizontalAlignment="Center" /> | ||
<Label>None</Label> | ||
</StackPanel> | ||
</Button> | ||
<Button Name="InvertCheck" HorizontalContentAlignment="Left" Click="InvertCheck_Clicked" ClickMode="Release"> | ||
<StackPanel Orientation="Horizontal"> | ||
<iconPacks:PackIconMaterial Kind="{x:Static iconPacks:PackIconMaterialKind.CheckBoxOutline}" VerticalAlignment="Center" HorizontalAlignment="Center" /> | ||
<Label>Invert</Label> | ||
</StackPanel> | ||
</Button> | ||
<Button Name="Export" HorizontalContentAlignment="Left" Click="Export_Clicked" ClickMode="Release"> | ||
<StackPanel Orientation="Horizontal"> | ||
<iconPacks:PackIconMaterial Kind="{x:Static iconPacks:PackIconMaterialKind.FileExport}" VerticalAlignment="Center" HorizontalAlignment="Center" /> | ||
<Label>Export</Label> | ||
</StackPanel> | ||
</Button> | ||
</StackPanel> | ||
<ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto"> | ||
<ListBox Name="ModList" | ||
BorderThickness="0" | ||
ItemsSource="{Binding Path=Test}" | ||
dd:DragDrop.IsDragSource="True" | ||
dd:DragDrop.IsDropTarget="True" | ||
dd:DragDrop.UseDefaultDragAdorner="True" | ||
dd:DragDrop.UseVisualSourceItemSizeForDragAdorner="True" | ||
SelectionMode="Extended" | ||
SelectionChanged="ModList_OnSelectionChanged" | ||
> | ||
<ListBox.Resources> | ||
<HierarchicalDataTemplate DataType="{x:Type local:ItemPresenter}"> | ||
<StackPanel Orientation="Horizontal"> | ||
<CheckBox Focusable="False" IsChecked="{Binding IsChecked}" VerticalAlignment="Center" /> | ||
<TextBlock Text="{Binding Name}" Margin="5,0" /> | ||
</StackPanel> | ||
</HierarchicalDataTemplate> | ||
</ListBox.Resources> | ||
<ListBox.ItemContainerStyle> | ||
<Style TargetType="ListBoxItem"> | ||
<Setter Property="IsSelected" Value="{Binding IsSelected}" /> | ||
</Style> | ||
</ListBox.ItemContainerStyle> | ||
<ListBox.Template> | ||
<ControlTemplate TargetType="ItemsControl"> | ||
<Border> | ||
<ItemsPresenter /> | ||
</Border> | ||
</ControlTemplate> | ||
</ListBox.Template> | ||
</ListBox> | ||
</ScrollViewer> | ||
</Grid> | ||
</Window> |
Oops, something went wrong.