Skip to content

Commit

Permalink
UI Resizing, Regex Fixes, and Recommended Modes
Browse files Browse the repository at this point in the history
Replaced panels, layouts, etc. for most windows to allow for proper resizing

Tweaked and adjusted Regex patterns to be more resilient and reliable

Added an automatically retrieved list of recommended gamemodes from the 'Custom Rulesets Directory' ppy/osu#5852
  • Loading branch information
Neonalig committed Oct 25, 2020
1 parent eb81364 commit 4b43373
Show file tree
Hide file tree
Showing 21 changed files with 670 additions and 337 deletions.
58 changes: 31 additions & 27 deletions App.config
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>

<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="OsuModeManager.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<userSettings>
<OsuModeManager.Properties.Settings>
<setting name="OsuLazerInstallationPath" serializeAs="String">
<value />
</setting>
<setting name="LatestToken" serializeAs="String">
<value />
</setting>
<setting name="LatestTokenCreationTime" serializeAs="String">
<value />
</setting>
</OsuModeManager.Properties.Settings>
</userSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="x86"/>
</assemblyBinding>
</runtime>
<configSections>
<sectionGroup name="userSettings"
type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="OsuModeManager.Properties.Settings"
type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<userSettings>
<OsuModeManager.Properties.Settings>
<setting name="OsuLazerInstallationPath" serializeAs="String">
<value />
</setting>
<setting name="LatestToken" serializeAs="String">
<value />
</setting>
<setting name="LatestTokenCreationTime" serializeAs="String">
<value />
</setting>
</OsuModeManager.Properties.Settings>
</userSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<probing privatePath="x86" />
</assemblyBinding>
</runtime>
</configuration>
5 changes: 3 additions & 2 deletions App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<!-- MahApps Theme -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Dark.Orange.xaml" />
<ResourceDictionary
Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Dark.Orange.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
</Application>
10 changes: 9 additions & 1 deletion App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
namespace OsuModeManager { public partial class App { } }
#region Copyright (C) 2017-2020 Starflash Studios
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License (Version 3.0)
// as published by the Free Software Foundation.
//
// More information can be found here: https://www.gnu.org/licenses/gpl-3.0.en.html
#endregion

namespace OsuModeManager { public partial class App { } }
30 changes: 24 additions & 6 deletions Extensions/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
using System.Collections.Generic;
using System.IO;
#region Copyright (C) 2017-2020 Starflash Studios
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License (Version 3.0)
// as published by the Free Software Foundation.
//
// More information can be found here: https://www.gnu.org/licenses/gpl-3.0.en.html
#endregion

#region Using Directives

using System;
using System.Diagnostics;
using System.Linq;
using System.Security;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Ookii.Dialogs.Wpf;

namespace OsuModeManager {
#endregion

namespace OsuModeManager.Extensions {
public static class Extensions {
public static bool TryGetFirst<T>(this IEnumerable<T> Enum, out T Result, bool Enumerate = false) {
// ReSharper disable PossibleMultipleEnumeration
if (Enumerate) { Enum = Enum.ToArray(); }

if (Enum != null && Enum.Any()) {
Result = Enum.First();
return Result != null;
}

Result = default;
return false;
// ReSharper restore PossibleMultipleEnumeration
Expand All @@ -27,9 +38,11 @@ public static bool TryGetAt<T>(this T[] Array, int Index, out T Result) {
Result = default;
return false;
}

Result = Array[Index];
return Result != null;
}

public static bool IsNullOrEmpty(this string String) => string.IsNullOrEmpty(String);

public static int Clamp(this int Value, int Min = int.MinValue, int Max = int.MaxValue) => Value < Min ? Min : Value > Max ? Max : Value;
Expand All @@ -46,5 +59,10 @@ public static Task WaitForExitAsync(this Process Process,
return Tcs.Task;
}

static readonly string[] _LineSplits = {
"\r\n", "\r", "\n"
};
public static string[] GetLines(this string S, StringSplitOptions SplitOptions = StringSplitOptions.RemoveEmptyEntries) => S.Split(_LineSplits, SplitOptions);

}
}
24 changes: 17 additions & 7 deletions Extensions/FileExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
using System;
#region Copyright (C) 2017-2020 Starflash Studios
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License (Version 3.0)
// as published by the Free Software Foundation.
//
// More information can be found here: https://www.gnu.org/licenses/gpl-3.0.en.html
#endregion

#region Using Directives

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Cryptography;
using System.Text;
using Ookii.Dialogs.Wpf;

using Shell32;
using Syroot.Windows.IO;

namespace OsuModeManager {
public static class FileExtensions {
#endregion

namespace OsuModeManager.Extensions {
public static class FileExtensions {

#region Assembly Reflection
/// <summary> Returns the location of the ExecutingAssembly parsed as a <see cref="FileInfo"/>. See also: <seealso cref="Assembly.GetExecutingAssembly"/>. </summary>
public static FileInfo GetExecutable() => new FileInfo(Assembly.GetExecutingAssembly().Location);
Expand Down Expand Up @@ -297,11 +307,11 @@ public static FileInfo GetUserFile(string Title = "Pick a file", string Filter =
#region FileInfo Reading
public static string[] ReadAllLines(this FileInfo FileInfo) => File.ReadAllLines(FileInfo.FullName);

public static string[] ReadAllLines(this FileInfo FileInfo, System.Text.Encoding Encoding) => File.ReadAllLines(FileInfo.FullName, Encoding);
public static string[] ReadAllLines(this FileInfo FileInfo, Encoding Encoding) => File.ReadAllLines(FileInfo.FullName, Encoding);

public static string ReadAllText(this FileInfo FileInfo) => File.ReadAllText(FileInfo.FullName);

public static string ReadAllText(this FileInfo FileInfo, System.Text.Encoding Encoding) => File.ReadAllText(FileInfo.FullName, Encoding);
public static string ReadAllText(this FileInfo FileInfo, Encoding Encoding) => File.ReadAllText(FileInfo.FullName, Encoding);

public static byte[] ReadAllBytes(this FileInfo FileInfo) => File.ReadAllBytes(FileInfo.FullName);
#endregion
Expand Down
29 changes: 19 additions & 10 deletions Gamemode.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
using System;
#region Copyright (C) 2017-2020 Starflash Studios
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License (Version 3.0)
// as published by the Free Software Foundation.
//
// More information can be found here: https://www.gnu.org/licenses/gpl-3.0.en.html
#endregion

#region Using Directives

using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using MahApps.Metro.IconPacks;
using Octokit;
using OsuModeManager.Extensions;
using OsuModeManager.Windows;

#endregion

namespace OsuModeManager {
public struct Gamemode : IEquatable<Gamemode>, ICloneable {
Expand All @@ -17,7 +32,7 @@ public struct Gamemode : IEquatable<Gamemode>, ICloneable {

public UpdateStatus UpdateStatus;

public System.Windows.Visibility DisplayAnyIcon => UpdateStatus == UpdateStatus.Unchecked ? System.Windows.Visibility.Hidden : System.Windows.Visibility.Visible;
public Visibility DisplayAnyIcon => UpdateStatus == UpdateStatus.Unchecked ? Visibility.Collapsed : Visibility.Visible;

public PackIconMaterialKind DisplayIconType {
get {
Expand Down Expand Up @@ -148,7 +163,7 @@ public static IEnumerable<Gamemode> ImportGamemodes(FileInfo GamemodeFile) {
public override int GetHashCode() {
unchecked {
// ReSharper disable NonReadonlyMemberInGetHashCode
int HashCode = (GitHubUser != null ? GitHubUser.GetHashCode() : 0);
int HashCode = GitHubUser != null ? GitHubUser.GetHashCode() : 0;
HashCode = (HashCode * 397) ^ (GitHubRepo != null ? GitHubRepo.GetHashCode() : 0);
HashCode = (HashCode * 397) ^ (GitHubTagVersion != null ? GitHubTagVersion.GetHashCode() : 0);
HashCode = (HashCode * 397) ^ (RulesetFilename != null ? RulesetFilename.GetHashCode() : 0);
Expand All @@ -171,10 +186,4 @@ public bool Equals(Gamemode Other) =>
#endregion
}

public enum UpdateStatus {
Unchecked,
UpToDate,
UpdateRequired,
FileMissing
}
}
1 change: 1 addition & 0 deletions Osu!ModeManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Extensions\FileExtensions.cs" />
<Compile Include="UpdateStatus.cs" />
<Compile Include="Windows\ReleaseWindow.xaml.cs">
<DependentUpon>ReleaseWindow.xaml</DependentUpon>
</Compile>
Expand Down
22 changes: 16 additions & 6 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
#region Copyright (C) 2017-2020 Starflash Studios
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License (Version 3.0)
// as published by the Free Software Foundation.
//
// More information can be found here: https://www.gnu.org/licenses/gpl-3.0.en.html
#endregion

#region Using Directives

using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;

#endregion

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Osu!ModeManager")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyDescription("A WPF-based osu!lazer gamemode update-checker utilising GitHub")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("Starflash Studios")]
[assembly: AssemblyProduct("Osu!ModeManager")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
Expand Down Expand Up @@ -51,5 +61,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.3.0")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
16 changes: 16 additions & 0 deletions UpdateStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#region Copyright (C) 2017-2020 Starflash Studios
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License (Version 3.0)
// as published by the Free Software Foundation.
//
// More information can be found here: https://www.gnu.org/licenses/gpl-3.0.en.html
#endregion

namespace OsuModeManager {
public enum UpdateStatus {
Unchecked,
UpToDate,
UpdateRequired,
FileMissing
}
}
Loading

0 comments on commit 4b43373

Please sign in to comment.