mirror of
https://github.com/muskit/MercuryConverter.git
synced 2026-06-02 20:24:26 -07:00
first commit
This commit is contained in:
+134
@@ -0,0 +1,134 @@
|
||||
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
x64/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.log
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.Publish.xml
|
||||
*.pubxml
|
||||
*.azurePubxml
|
||||
|
||||
# NuGet Packages Directory
|
||||
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
|
||||
packages/
|
||||
## TODO: If the tool you use requires repositories.config, also uncomment the next line
|
||||
!packages/repositories.config
|
||||
|
||||
# Windows Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
|
||||
# Others
|
||||
sql/
|
||||
*.Cache
|
||||
ClientBin/
|
||||
[Ss]tyle[Cc]op.*
|
||||
![Ss]tyle[Cc]op.targets
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.[Pp]ublish.xml
|
||||
|
||||
*.publishsettings
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file to a newer
|
||||
# Visual Studio version. Backup files are not needed, because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
|
||||
# SQL Server files
|
||||
App_Data/*.mdf
|
||||
App_Data/*.ldf
|
||||
|
||||
# =========================
|
||||
# Windows detritus
|
||||
# =========================
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Mac desktop service store files
|
||||
.DS_Store
|
||||
|
||||
_NCrunch*
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -0,0 +1,11 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="MercuryConverter.App"
|
||||
RequestedThemeVariant="Default">
|
||||
<!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
|
||||
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
@@ -0,0 +1,23 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
namespace MercuryConverter;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
desktop.MainWindow = new MainWindow();
|
||||
}
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
|
||||
namespace MercuryConverter.Data;
|
||||
|
||||
|
||||
public class Chart
|
||||
{
|
||||
public required string audioId;
|
||||
public required string audioOffset;
|
||||
public required string audioPreviewTime;
|
||||
public required string audioPreviewDuration;
|
||||
public required string video;
|
||||
public required string designer;
|
||||
public required string clearRequirement;
|
||||
public required string diffLevel;
|
||||
public string diffString
|
||||
{
|
||||
get
|
||||
{
|
||||
var d = Convert.ToDouble(diffLevel);
|
||||
var i = (int)d;
|
||||
return $"{(int)d}{(d > i ? "+" : "")}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MercuryConverter.Data;
|
||||
|
||||
public static class Consts
|
||||
{
|
||||
private static Dictionary<int, string> _CATEGORY_INDEX = new()
|
||||
{
|
||||
{ -1, "Unknown"},
|
||||
{ 0, "Anime/Pop"},
|
||||
{ 1, "Vocaloid"},
|
||||
{ 2, "Touhou Project"},
|
||||
{ 3, "2.5D" },
|
||||
{ 4, "Variety" },
|
||||
{ 5, "Original" },
|
||||
{ 6, "HARDCORE TANO*C" },
|
||||
{ 7, "VTuber" },
|
||||
};
|
||||
public static readonly IReadOnlyDictionary<int, string> CATEGORY_INDEX = _CATEGORY_INDEX;
|
||||
|
||||
private static Dictionary<int, string> _NUM_SOURCE = new()
|
||||
{
|
||||
{ 1, string.Concat(new int[] {87, 65, 67, 67, 65}.Select(i => Convert.ToChar(i))) },
|
||||
{ 2, string.Concat(new int[] {87, 65, 67, 67, 65, 32, 83}.Select(i => Convert.ToChar(i))) },
|
||||
{ 3, string.Concat(new int[] {87, 65, 67, 67, 65, 32, 76, 73, 76, 89}.Select(i => Convert.ToChar(i))) },
|
||||
{ 4, string.Concat(new int[] {87, 65, 67, 67, 65, 32, 76, 73, 76, 89, 32, 82}.Select(i => Convert.ToChar(i))) },
|
||||
{ 5, string.Concat(new int[] {87, 65, 67, 67, 65, 32, 82, 101, 118, 101, 114, 115, 101}.Select(i => Convert.ToChar(i))) }
|
||||
};
|
||||
public static readonly IReadOnlyDictionary<int, string> NUM_SOURCE = _NUM_SOURCE;
|
||||
public static readonly IReadOnlyDictionary<string, int> SOURCE_NUM = _NUM_SOURCE.ToDictionary(p => p.Value, p=>p.Key);
|
||||
|
||||
private static string[] _DIFFICULTIES = {
|
||||
"Normal", "Hard", "Expert", "Inferno"
|
||||
};
|
||||
public static readonly IReadOnlyList<string> DIFFICULTIES = _DIFFICULTIES;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace MercuryConverter.Data;
|
||||
|
||||
public class Song
|
||||
{
|
||||
/// <summary>
|
||||
/// Format: `Snn-nnn` where `n` is a digit.
|
||||
/// </summary>
|
||||
public required string id;
|
||||
public required string name;
|
||||
public required string rubi;
|
||||
public required string artist;
|
||||
public required string copyright;
|
||||
public required string tempo;
|
||||
public required string version;
|
||||
public required int genreId;
|
||||
public required string game;
|
||||
public required string jacket;
|
||||
public Chart?[] charts = { null, null, null, null };
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
namespace MercuryConverter;
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
public static class Database
|
||||
{
|
||||
public static readonly ObservableCollection<Data.Song> Songs = new();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<Window xmlns="https://github.com/avaloniaui"
|
||||
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:MercuryConverter"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
|
||||
x:Class="MercuryConverter.MainWindow"
|
||||
Title="MercuryConverter"
|
||||
Width="1024" Height="800"
|
||||
ExtendClientAreaToDecorationsHint="True"
|
||||
>
|
||||
<StackPanel>
|
||||
<DockPanel LastChildFill="False">
|
||||
<Menu Name="MenuBar" DockPanel.Dock="Left">
|
||||
<MenuItem Header="File">
|
||||
<MenuItem Header="Open Data Folder..." />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</DockPanel>
|
||||
<TabControl>
|
||||
<TabItem Header="selection">
|
||||
<UserControl Name="SelectionControl"/>
|
||||
</TabItem>
|
||||
<TabItem Header="export">
|
||||
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,36 @@
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Styling;
|
||||
|
||||
namespace MercuryConverter;
|
||||
|
||||
using MercuryConverter.Views;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public string RunType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Design.IsDesignMode)
|
||||
{
|
||||
return "In Design!";
|
||||
}
|
||||
return "In Runtime.";
|
||||
}
|
||||
}
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Force dark mode in designer
|
||||
if (Design.IsDesignMode)
|
||||
{
|
||||
RequestedThemeVariant = ThemeVariant.Dark;
|
||||
}
|
||||
// LblPlatform.Content = RunType;
|
||||
|
||||
// Setup tab views
|
||||
SelectionControl.Content = new Selection();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.3.2" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.3.2" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.2" />
|
||||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.2" />
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.3.2" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.2">
|
||||
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
|
||||
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,24 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.5.2.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MercuryConverter", "MercuryConverter.csproj", "{8D7AB684-46C8-6289-FBE5-52DC512A35BE}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8D7AB684-46C8-6289-FBE5-52DC512A35BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8D7AB684-46C8-6289-FBE5-52DC512A35BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8D7AB684-46C8-6289-FBE5-52DC512A35BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8D7AB684-46C8-6289-FBE5-52DC512A35BE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8A55B6C1-9740-4A8D-859C-4CC399386136}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
using Avalonia;
|
||||
using System;
|
||||
|
||||
namespace MercuryConverter;
|
||||
|
||||
class Program
|
||||
{
|
||||
// Initialization code. Don't use any Avalonia, third-party APIs or any
|
||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||
// yet and stuff might break.
|
||||
[STAThread]
|
||||
public static void Main(string[] args) => BuildAvaloniaApp()
|
||||
.StartWithClassicDesktopLifetime(args);
|
||||
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.WithInterFont()
|
||||
.LogToTrace();
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<Panel xmlns="https://github.com/avaloniaui"
|
||||
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:MercuryConverter.Views"
|
||||
x:Class="MercuryConverter.Views.Selection"
|
||||
>
|
||||
<DockPanel>
|
||||
<ContentControl Name="SelectionInfo" DockPanel.Dock="Right" Width="250">
|
||||
<Label Content="SelectionInfo"/>
|
||||
</ContentControl>
|
||||
<StackPanel>
|
||||
<Expander HorizontalAlignment="Stretch" BorderThickness="0">
|
||||
<Expander.Header>
|
||||
Search/Filter
|
||||
</Expander.Header>
|
||||
<StackPanel Name="Filter">
|
||||
<TextBox />
|
||||
</StackPanel>
|
||||
</Expander>
|
||||
<DataGrid Name="ListingTable">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="ID"/>
|
||||
<DataGridTextColumn Header="Title"/>
|
||||
<DataGridTextColumn Header="Artist"/>
|
||||
<DataGridTextColumn Header="Source"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Panel>
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using Avalonia.Controls;
|
||||
|
||||
namespace MercuryConverter.Views;
|
||||
|
||||
public partial class Selection : Panel
|
||||
{
|
||||
public Selection()
|
||||
{
|
||||
InitializeComponent();
|
||||
Database.Songs.CollectionChanged += OnSongsChg;
|
||||
}
|
||||
|
||||
private void OnSongsChg(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
Console.WriteLine("Songs collection changed!");
|
||||
|
||||
if (e.NewItems != null)
|
||||
{
|
||||
Console.WriteLine("Added...");
|
||||
foreach (Data.Song added in e.NewItems)
|
||||
{
|
||||
Console.WriteLine($"[{added.id}] {added.artist} - {added.name}");
|
||||
}
|
||||
}
|
||||
if (e.OldItems != null)
|
||||
{
|
||||
Console.WriteLine("Removed...");
|
||||
foreach (Data.Song rem in e.OldItems)
|
||||
{
|
||||
Console.WriteLine($"[{rem.id}] {rem.artist} - {rem.name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<!-- This manifest is used on Windows only.
|
||||
Don't remove it as it might cause problems with window transparency and embedded controls.
|
||||
For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
|
||||
<assemblyIdentity version="1.0.0.0" name="MercuryConverter.Desktop"/>
|
||||
|
||||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||
<application>
|
||||
<!-- A list of the Windows versions that this application has been tested on
|
||||
and is designed to work with. Uncomment the appropriate elements
|
||||
and Windows will automatically select the most compatible environment. -->
|
||||
|
||||
<!-- Windows 10 -->
|
||||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
|
||||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
Reference in New Issue
Block a user