diff --git a/BallanceTasEditor.sln b/BallanceTasEditor.sln new file mode 100644 index 0000000..4625436 --- /dev/null +++ b/BallanceTasEditor.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36414.22 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BallanceTasEditor", "BallanceTasEditor\BallanceTasEditor.csproj", "{DD898514-03ED-4257-AFD1-290EEDF68113}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BallanceTasEditorTest", "BallanceTasEditorTest\BallanceTasEditorTest.csproj", "{1DC1A8CD-E963-4FF8-91D9-059522419961}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DD898514-03ED-4257-AFD1-290EEDF68113}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DD898514-03ED-4257-AFD1-290EEDF68113}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DD898514-03ED-4257-AFD1-290EEDF68113}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DD898514-03ED-4257-AFD1-290EEDF68113}.Release|Any CPU.Build.0 = Release|Any CPU + {1DC1A8CD-E963-4FF8-91D9-059522419961}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1DC1A8CD-E963-4FF8-91D9-059522419961}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1DC1A8CD-E963-4FF8-91D9-059522419961}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1DC1A8CD-E963-4FF8-91D9-059522419961}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5A4468A2-79ED-47F3-80FE-299A89DE9D0E} + EndGlobalSection +EndGlobal diff --git a/BallanceTasEditor/App.ico b/BallanceTasEditor/App.ico new file mode 100644 index 0000000..07673cf Binary files /dev/null and b/BallanceTasEditor/App.ico differ diff --git a/BallanceTasEditor/App.xaml b/BallanceTasEditor/App.xaml new file mode 100644 index 0000000..fb35fae --- /dev/null +++ b/BallanceTasEditor/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/BallanceTasEditor/App.xaml.cs b/BallanceTasEditor/App.xaml.cs new file mode 100644 index 0000000..1e5aed7 --- /dev/null +++ b/BallanceTasEditor/App.xaml.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace BallanceTasEditor { + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application { + } +} diff --git a/BallanceTasEditor/Assets/App.ico b/BallanceTasEditor/Assets/App.ico new file mode 100644 index 0000000..95ad06c Binary files /dev/null and b/BallanceTasEditor/Assets/App.ico differ diff --git a/BallanceTasEditor/BallanceTasEditor.csproj b/BallanceTasEditor/BallanceTasEditor.csproj new file mode 100644 index 0000000..cc6e093 --- /dev/null +++ b/BallanceTasEditor/BallanceTasEditor.csproj @@ -0,0 +1,151 @@ + + + + + Debug + AnyCPU + {DD898514-03ED-4257-AFD1-290EEDF68113} + WinExe + BallanceTasEditor + BallanceTasEditor + v4.8 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + App.ico + + + + ..\packages\CommunityToolkit.Mvvm.8.2.1\lib\netstandard2.0\CommunityToolkit.Mvvm.dll + + + ..\packages\DotNetZip.1.9.1.8\lib\net20\Ionic.Zip.dll + + + ..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll + + + + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + + + ..\packages\System.ComponentModel.Annotations.5.0.0\lib\net461\System.ComponentModel.Annotations.dll + + + + + ..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll + + + + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + + + ..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll + + + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/BallanceTasEditor/Properties/AssemblyInfo.cs b/BallanceTasEditor/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d6243a2 --- /dev/null +++ b/BallanceTasEditor/Properties/AssemblyInfo.cs @@ -0,0 +1,52 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 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("BallanceTasEditor")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("BallanceTasEditor")] +[assembly: AssemblyCopyright("Copyright © 2025")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[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) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/BallanceTasEditor/Properties/Resources.Designer.cs b/BallanceTasEditor/Properties/Resources.Designer.cs new file mode 100644 index 0000000..a4d2b22 --- /dev/null +++ b/BallanceTasEditor/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace BallanceTasEditor.Properties { + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("BallanceTasEditor.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/BallanceTasEditor/Properties/Resources.resx b/BallanceTasEditor/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/BallanceTasEditor/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/BallanceTasEditor/Properties/Settings.Designer.cs b/BallanceTasEditor/Properties/Settings.Designer.cs new file mode 100644 index 0000000..33a702d --- /dev/null +++ b/BallanceTasEditor/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace BallanceTasEditor.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/BallanceTasEditor/Properties/Settings.settings b/BallanceTasEditor/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/BallanceTasEditor/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/BallanceTasEditor/Utils/TasFrame.cs b/BallanceTasEditor/Utils/TasFrame.cs new file mode 100644 index 0000000..ff56f21 --- /dev/null +++ b/BallanceTasEditor/Utils/TasFrame.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace BallanceTasEditor.Utils { + + /// + /// 描述TAS文件中一帧的结构。 + /// + [StructLayout(LayoutKind.Sequential)] + public struct TasFrame { + /// + /// 该帧的持续时间(以秒为单位)。 + /// + public float TimeDelta; + /// + /// 该帧的按键组合。 + /// + public uint KeyFlags; + + /// + /// 判断按键是否被按下。 + /// + /// 要检查的按键。 + /// true表示被按下,否则为false。 + public bool IsKeyPressed(TasKey key) { + return (KeyFlags & (1u << (int)key)) != 0; + } + + /// + /// 设置按键状态。 + /// + /// 要设置的按键。 + /// true表示设置为按下,否则为松开。 + public void SetKeyPressed(TasKey key, bool pressed = true) { + if (pressed) KeyFlags |= (1u << (int)key); + else KeyFlags &= ~(1u << (int)key); + } + + /// + /// 反转按键状态。 + /// + /// 要反转的按键。 + public void FlipKeyPressed(TasKey key) { + KeyFlags ^= (1u << (int)key); + } + + /// + /// 获取或设置Up键的按下状态。 + /// + public bool KeyUpPressed { get { return IsKeyPressed(TasKey.KeyUp); } set { SetKeyPressed(TasKey.KeyUp, value); } } + /// + /// 获取或设置Down键的按下状态。 + /// + public bool KeyDownPressed { get { return IsKeyPressed(TasKey.KeyDown); } set { SetKeyPressed(TasKey.KeyDown, value); } } + /// + /// 获取或设置Left键的按下状态。 + /// + public bool KeyLeftPressed { get { return IsKeyPressed(TasKey.KeyLeft); } set { SetKeyPressed(TasKey.KeyLeft, value); } } + /// + /// 获取或设置Right键的按下状态。 + /// + public bool KeyRightPressed { get { return IsKeyPressed(TasKey.KeyRight); } set { SetKeyPressed(TasKey.KeyRight, value); } } + /// + /// 获取或设置Shift键的按下状态。 + /// + public bool KeyShiftPressed { get { return IsKeyPressed(TasKey.KeyShift); } set { SetKeyPressed(TasKey.KeyShift, value); } } + /// + /// 获取或设置Space键的按下状态。 + /// + public bool KeySpacePressed { get { return IsKeyPressed(TasKey.KeySpace); } set { SetKeyPressed(TasKey.KeySpace, value); } } + /// + /// 获取或设置Q键的按下状态。 + /// + public bool KeyQPressed { get { return IsKeyPressed(TasKey.KeyQ); } set { SetKeyPressed(TasKey.KeyQ, value); } } + /// + /// 获取或设置Esc键的按下状态。 + /// + public bool KeyEscPressed { get { return IsKeyPressed(TasKey.KeyEsc); } set { SetKeyPressed(TasKey.KeyEsc, value); } } + /// + /// 获取或设置回车键的按下状态。 + /// + public bool KeyEnterPressed { get { return IsKeyPressed(TasKey.KeyEnter); } set { SetKeyPressed(TasKey.KeyEnter, value); } } + + } + + /// + /// 描述TAS文件中的可能的按键。 + /// + public enum TasKey : int { + KeyUp = 0, + KeyDown = 1, + KeyLeft = 2, + KeyRight = 3, + KeyShift = 4, + KeySpace = 5, + KeyQ = 6, + KeyEsc = 7, + KeyEnter = 8, + } + +} diff --git a/BallanceTasEditor/Views/MainWindow.xaml b/BallanceTasEditor/Views/MainWindow.xaml new file mode 100644 index 0000000..a77d267 --- /dev/null +++ b/BallanceTasEditor/Views/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/BallanceTasEditor/Views/MainWindow.xaml.cs b/BallanceTasEditor/Views/MainWindow.xaml.cs new file mode 100644 index 0000000..d3892bf --- /dev/null +++ b/BallanceTasEditor/Views/MainWindow.xaml.cs @@ -0,0 +1,25 @@ +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.Navigation; +using System.Windows.Shapes; + +namespace BallanceTasEditor.Views { + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window { + public MainWindow() { + InitializeComponent(); + } + } +} diff --git a/BallanceTasEditor/app.config b/BallanceTasEditor/app.config new file mode 100644 index 0000000..7c4b745 --- /dev/null +++ b/BallanceTasEditor/app.config @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BallanceTasEditor/packages.config b/BallanceTasEditor/packages.config new file mode 100644 index 0000000..3cbb11b --- /dev/null +++ b/BallanceTasEditor/packages.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file